add solicitation task and validations
All checks were successful
Build and Publish / build-release (push) Successful in 1m28s
All checks were successful
Build and Publish / build-release (push) Successful in 1m28s
This commit is contained in:
@@ -24,29 +24,96 @@ defmodule WorkloadServiceWeb.Schemas.Task do
|
||||
OpenApiSpex.schema(%{
|
||||
title: "Plan",
|
||||
type: :object,
|
||||
required: [:plan_id, :name, :premium, :coverage_details],
|
||||
properties: %{
|
||||
plan_id: %Schema{type: :string},
|
||||
name: %Schema{type: :string},
|
||||
premium: %Schema{type: :number, exclusiveMinimum: 0},
|
||||
coverage_details: %Schema{type: :object, additionalProperties: true}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
defmodule QuoteTaskInfo do
|
||||
require OpenApiSpex
|
||||
|
||||
OpenApiSpex.schema(%{
|
||||
title: "QuoteTaskInfo",
|
||||
type: :object,
|
||||
required: [:provider_id, :applicant_info, :policy_details],
|
||||
properties: %{
|
||||
provider_id: %Schema{type: :string},
|
||||
applicant_info: %Schema{type: :object, additionalProperties: true},
|
||||
policy_details: %Schema{type: :object, additionalProperties: true},
|
||||
provider_email: %Schema{type: :string, nullable: true}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
defmodule SolicitationTaskInfo do
|
||||
require OpenApiSpex
|
||||
|
||||
OpenApiSpex.schema(%{
|
||||
title: "SolicitationTaskInfo",
|
||||
type: :object,
|
||||
required: [:provider_id, :plan_id, :plan_name, :premium, :coverage_details],
|
||||
properties: %{
|
||||
provider_id: %Schema{type: :string},
|
||||
plan_id: %Schema{type: :string},
|
||||
plan_name: %Schema{type: :string},
|
||||
premium: %Schema{type: :number},
|
||||
coverage_details: %Schema{type: :object, additionalProperties: true}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
defmodule QuoteSubmissionDetail do
|
||||
require OpenApiSpex
|
||||
|
||||
OpenApiSpex.schema(%{
|
||||
title: "QuoteSubmissionDetail",
|
||||
type: :object,
|
||||
required: [:quote_id, :recorded_by, :valid_until, :plans],
|
||||
properties: %{
|
||||
quote_id: %Schema{type: :string},
|
||||
recorded_by: %Schema{type: :string},
|
||||
valid_until: %Schema{type: :string, format: :date},
|
||||
plans: %Schema{type: :array, items: Plan, minItems: 1},
|
||||
document_data: %Schema{type: :object, additionalProperties: true, nullable: true},
|
||||
document_url: %Schema{type: :string, nullable: true}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
defmodule SolicitationSubmissionDetail do
|
||||
require OpenApiSpex
|
||||
|
||||
OpenApiSpex.schema(%{
|
||||
title: "SolicitationSubmissionDetail",
|
||||
type: :object,
|
||||
required: [:provider_policy_number, :effective_date, :expiry_date],
|
||||
properties: %{
|
||||
provider_policy_number: %Schema{type: :string},
|
||||
effective_date: %Schema{type: :string, format: :date},
|
||||
expiry_date: %Schema{type: :string, format: :date}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
defmodule QuoteSubmission do
|
||||
require OpenApiSpex
|
||||
|
||||
OpenApiSpex.schema(%{
|
||||
title: "QuoteSubmission",
|
||||
type: :object,
|
||||
required: [:recorded_by, :quote_id],
|
||||
required: [:quote_id, :recorded_by, :valid_until, :plans],
|
||||
properties: %{
|
||||
recorded_by: %Schema{type: :string},
|
||||
quote_id: %Schema{type: :string},
|
||||
recorded_by: %Schema{type: :string},
|
||||
valid_until: %Schema{type: :string, format: :date},
|
||||
plans: %Schema{type: :array, items: Plan},
|
||||
document_url: %Schema{type: :string},
|
||||
document_data: %Schema{type: :object, additionalProperties: true}
|
||||
plans: %Schema{type: :array, items: Plan, minItems: 1},
|
||||
document_data: %Schema{type: :object, additionalProperties: true, nullable: true},
|
||||
document_url: %Schema{type: :string, nullable: true}
|
||||
}
|
||||
})
|
||||
end
|
||||
@@ -57,9 +124,11 @@ defmodule WorkloadServiceWeb.Schemas.Task do
|
||||
OpenApiSpex.schema(%{
|
||||
title: "SolicitationSubmission",
|
||||
type: :object,
|
||||
required: [:recorded_by],
|
||||
required: [:provider_policy_number, :effective_date, :expiry_date],
|
||||
properties: %{
|
||||
recorded_by: %Schema{type: :string}
|
||||
provider_policy_number: %Schema{type: :string},
|
||||
effective_date: %Schema{type: :string, format: :date},
|
||||
expiry_date: %Schema{type: :string, format: :date}
|
||||
}
|
||||
})
|
||||
end
|
||||
@@ -74,7 +143,8 @@ defmodule WorkloadServiceWeb.Schemas.Task do
|
||||
id: %Schema{type: :string},
|
||||
org_id: %Schema{type: :string},
|
||||
application_id: %Schema{type: :string},
|
||||
task_info: %Schema{type: :object},
|
||||
policy_type: %Schema{type: :string, enum: ["car", "life", "fire"]},
|
||||
task_info: %Schema{oneOf: [QuoteTaskInfo, SolicitationTaskInfo]},
|
||||
status: %Schema{type: :string, enum: ["created", "draft", "approved", "completed"]},
|
||||
created_at: %Schema{type: :string, format: :"date-time"}
|
||||
}
|
||||
@@ -91,8 +161,9 @@ defmodule WorkloadServiceWeb.Schemas.Task do
|
||||
id: %Schema{type: :string},
|
||||
org_id: %Schema{type: :string},
|
||||
application_id: %Schema{type: :string},
|
||||
task_info: %Schema{type: :object},
|
||||
submission: %Schema{type: :object, nullable: true},
|
||||
policy_type: %Schema{type: :string, enum: ["car", "life", "fire"]},
|
||||
task_info: %Schema{oneOf: [QuoteTaskInfo, SolicitationTaskInfo]},
|
||||
submission: %Schema{oneOf: [QuoteSubmissionDetail, SolicitationSubmissionDetail], nullable: true},
|
||||
attachments: %Schema{type: :array, items: %Schema{type: :string}},
|
||||
status: %Schema{type: :string, enum: ["created", "draft", "approved", "completed"]},
|
||||
created_at: %Schema{type: :string, format: :"date-time"},
|
||||
|
||||
Reference in New Issue
Block a user