simplify task api
All checks were successful
Build and Publish / build-release (push) Successful in 1m23s

This commit is contained in:
2026-04-17 11:42:19 -05:00
parent 202538e844
commit 01ad2270bc
13 changed files with 320 additions and 301 deletions

View File

@@ -26,11 +26,40 @@ defmodule WorkloadServiceWeb.Schemas.Task do
type: :object,
properties: %{
plan_id: %Schema{type: :string},
plan_name: %Schema{type: :string},
name: %Schema{type: :string},
premium: %Schema{type: :number},
coverage_details: %Schema{type: :string},
deductible: %Schema{type: :number, nullable: true},
coverage_limit: %Schema{type: :number, nullable: true}
coverage_details: %Schema{type: :object, additionalProperties: true}
}
})
end
defmodule QuoteSubmission do
require OpenApiSpex
OpenApiSpex.schema(%{
title: "QuoteSubmission",
type: :object,
required: [:recorded_by, :quote_id],
properties: %{
recorded_by: %Schema{type: :string},
quote_id: %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}
}
})
end
defmodule SolicitationSubmission do
require OpenApiSpex
OpenApiSpex.schema(%{
title: "SolicitationSubmission",
type: :object,
required: [:recorded_by],
properties: %{
recorded_by: %Schema{type: :string}
}
})
end
@@ -45,8 +74,6 @@ defmodule WorkloadServiceWeb.Schemas.Task do
id: %Schema{type: :string},
org_id: %Schema{type: :string},
application_id: %Schema{type: :string},
provider_id: %Schema{type: :string},
provider_name: %Schema{type: :string},
task_info: %Schema{type: :object},
status: %Schema{type: :string, enum: ["created", "draft", "approved", "completed"]},
created_at: %Schema{type: :string, format: :"date-time"}
@@ -64,8 +91,6 @@ defmodule WorkloadServiceWeb.Schemas.Task do
id: %Schema{type: :string},
org_id: %Schema{type: :string},
application_id: %Schema{type: :string},
provider_id: %Schema{type: :string},
provider_name: %Schema{type: :string},
task_info: %Schema{type: :object},
submission: %Schema{type: :object, nullable: true},
attachments: %Schema{type: :array, items: %Schema{type: :string}},
@@ -77,32 +102,24 @@ defmodule WorkloadServiceWeb.Schemas.Task do
})
end
defmodule QuoteResponseRequest do
defmodule SubmitRequest do
require OpenApiSpex
OpenApiSpex.schema(%{
title: "QuoteResponseRequest",
title: "SubmitRequest",
type: :object,
required: [:quote_id, :document_url],
properties: %{
quote_id: %Schema{type: :string},
plans: %Schema{type: :array, items: Plan},
valid_until: %Schema{type: :string, format: :date},
responded_by: %Schema{type: :string},
document_url: %Schema{type: :string},
document_data: %Schema{type: :object, additionalProperties: true}
}
anyOf: [QuoteSubmission, SolicitationSubmission]
})
end
defmodule ConfirmDeliveryRequest do
defmodule CompleteRequest do
require OpenApiSpex
OpenApiSpex.schema(%{
title: "ConfirmDeliveryRequest",
title: "CompleteRequest",
type: :object,
properties: %{
delivery_confirmed_by: %Schema{type: :string}
completed_by: %Schema{type: :string}
}
})
end
@@ -143,4 +160,4 @@ defmodule WorkloadServiceWeb.Schemas.Task do
}
})
end
end
end