This commit is contained in:
85
lib/policy_service/projections/policy.ex
Normal file
85
lib/policy_service/projections/policy.ex
Normal file
@@ -0,0 +1,85 @@
|
||||
defmodule PolicyService.Projections.PolicyApplication do
|
||||
use Ecto.Schema
|
||||
|
||||
@derive {Jason.Encoder,
|
||||
only: [
|
||||
:id,
|
||||
:application_id,
|
||||
:org_id,
|
||||
:submitted_by,
|
||||
:policy_type,
|
||||
:applicant_info,
|
||||
:policy_details,
|
||||
:selected_providers,
|
||||
:quotes,
|
||||
:accepted_quote_id,
|
||||
:accepted_plan_id,
|
||||
:accepted_provider_id,
|
||||
:accepted_by,
|
||||
:accepted_at,
|
||||
:solicitation_id,
|
||||
:solicitation_s3_key,
|
||||
:policy_number,
|
||||
:premium,
|
||||
:effective_date,
|
||||
:expiry_date,
|
||||
:status,
|
||||
:submitted_at,
|
||||
:solicitation_sent_at,
|
||||
:issued_at,
|
||||
:inserted_at,
|
||||
:updated_at
|
||||
]}
|
||||
|
||||
@derive {
|
||||
Flop.Schema,
|
||||
filterable: [:org_id, :policy_type, :status, :search],
|
||||
sortable: [:submitted_at, :policy_type, :status],
|
||||
default_limit: 20,
|
||||
max_limit: 100,
|
||||
custom_fields: [
|
||||
search: [
|
||||
filter: {PolicyService.Projections.PolicyApplicationFilters, :search, []},
|
||||
ecto_type: :string,
|
||||
operators: [:==]
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
@primary_key {:id, :string, autogenerate: false}
|
||||
@timestamps_opts [type: :utc_datetime_usec]
|
||||
|
||||
schema "policy_applications" do
|
||||
field :application_id, :string
|
||||
field :org_id, :string
|
||||
field :submitted_by, :string
|
||||
field :policy_type, :string
|
||||
|
||||
field :applicant_info, :map
|
||||
field :policy_details, :map
|
||||
|
||||
field :selected_providers, {:array, :string}, default: []
|
||||
field :quotes, :map, default: %{}
|
||||
|
||||
field :accepted_quote_id, :string
|
||||
field :accepted_plan_id, :string
|
||||
field :accepted_provider_id, :string
|
||||
field :accepted_by, :string
|
||||
field :accepted_at, :utc_datetime_usec
|
||||
|
||||
field :solicitation_id, :string
|
||||
field :solicitation_s3_key, :string
|
||||
|
||||
field :policy_number, :string
|
||||
field :premium, :decimal
|
||||
field :effective_date, :date
|
||||
field :expiry_date, :date
|
||||
|
||||
field :status, :string
|
||||
field :submitted_at, :utc_datetime_usec
|
||||
field :solicitation_sent_at, :utc_datetime_usec
|
||||
field :issued_at, :utc_datetime_usec
|
||||
|
||||
timestamps()
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user