init commit
This commit is contained in:
146
lib/workload_service_web/schemas/task.ex
Normal file
146
lib/workload_service_web/schemas/task.ex
Normal file
@@ -0,0 +1,146 @@
|
||||
defmodule WorkloadServiceWeb.Schemas.Task do
|
||||
alias OpenApiSpex.Schema
|
||||
|
||||
defmodule PaginationMeta do
|
||||
require OpenApiSpex
|
||||
|
||||
OpenApiSpex.schema(%{
|
||||
title: "PaginationMeta",
|
||||
type: :object,
|
||||
properties: %{
|
||||
total_count: %Schema{type: :integer},
|
||||
total_pages: %Schema{type: :integer},
|
||||
current_page: %Schema{type: :integer},
|
||||
page_size: %Schema{type: :integer},
|
||||
has_next: %Schema{type: :boolean},
|
||||
has_prev: %Schema{type: :boolean}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
defmodule Plan do
|
||||
require OpenApiSpex
|
||||
|
||||
OpenApiSpex.schema(%{
|
||||
title: "Plan",
|
||||
type: :object,
|
||||
properties: %{
|
||||
plan_id: %Schema{type: :string},
|
||||
plan_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}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
defmodule TaskSummary do
|
||||
require OpenApiSpex
|
||||
|
||||
OpenApiSpex.schema(%{
|
||||
title: "TaskSummary",
|
||||
type: :object,
|
||||
properties: %{
|
||||
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"}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
defmodule TaskDetail do
|
||||
require OpenApiSpex
|
||||
|
||||
OpenApiSpex.schema(%{
|
||||
title: "TaskDetail",
|
||||
type: :object,
|
||||
properties: %{
|
||||
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}},
|
||||
status: %Schema{type: :string, enum: ["created", "draft", "approved", "completed"]},
|
||||
version: %Schema{type: :integer},
|
||||
created_at: %Schema{type: :string, format: :"date-time"},
|
||||
updated_at: %Schema{type: :string, format: :"date-time"}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
defmodule QuoteResponseRequest do
|
||||
require OpenApiSpex
|
||||
|
||||
OpenApiSpex.schema(%{
|
||||
title: "QuoteResponseRequest",
|
||||
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}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
defmodule ConfirmDeliveryRequest do
|
||||
require OpenApiSpex
|
||||
|
||||
OpenApiSpex.schema(%{
|
||||
title: "ConfirmDeliveryRequest",
|
||||
type: :object,
|
||||
properties: %{
|
||||
delivery_confirmed_by: %Schema{type: :string}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
defmodule TaskListResponse do
|
||||
require OpenApiSpex
|
||||
|
||||
OpenApiSpex.schema(%{
|
||||
title: "TaskListResponse",
|
||||
type: :object,
|
||||
properties: %{
|
||||
data: %Schema{type: :array, items: TaskSummary},
|
||||
meta: PaginationMeta
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
defmodule TaskDetailResponse do
|
||||
require OpenApiSpex
|
||||
|
||||
OpenApiSpex.schema(%{
|
||||
title: "TaskDetailResponse",
|
||||
type: :object,
|
||||
properties: %{
|
||||
data: TaskDetail
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
defmodule ErrorResponse do
|
||||
require OpenApiSpex
|
||||
|
||||
OpenApiSpex.schema(%{
|
||||
title: "ErrorResponse",
|
||||
type: :object,
|
||||
properties: %{
|
||||
error: %Schema{type: :string}
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user