add dialyzer and fix id
All checks were successful
Build and Publish / build-release (push) Successful in 1m28s

This commit is contained in:
2026-04-21 14:26:37 -05:00
parent 2bf99bfb37
commit ca86980833
9 changed files with 158 additions and 29 deletions

View File

@@ -1,7 +1,8 @@
defmodule WorkloadService.Aggregates.QuoteTask do
use WorkloadService.Aggregates.Task,
task_type: "quote",
commands: WorkloadService.Commands.QuoteTask
commands: WorkloadService.Commands.QuoteTask,
submission_type: map()
def validate_submission(_) do
:ok

View File

@@ -1,7 +1,8 @@
defmodule WorkloadService.Aggregates.SolicitationTask do
use WorkloadService.Aggregates.Task,
task_type: "solicitation",
commands: WorkloadService.Commands.SolicitationTask
commands: WorkloadService.Commands.SolicitationTask,
submission_type: map()
def validate_submission(_) do
:ok

View File

@@ -8,24 +8,37 @@ defmodule WorkloadService.Aggregates.Task do
use WorkloadService.Aggregates.Task,
task_type: "quote"
end
"""
@type t :: %__MODULE__{
id: WorkloadService.Aggregates.TaskId.t() | nil,
application_id: WorkloadService.Aggregates.ApplicationId.t() | nil,
task_info: map() | nil,
submission: map() | nil,
attachments: [String.t()],
status: String.t() | nil
}
## With custom submission type
defmodule QuoteTaskWithCustomSubmission do
defmodule CustomSubmission do
@type t :: %{...custom_fields: term()}
end
use WorkloadService.Aggregates.Task,
task_type: "quote",
submission_type: CustomSubmission.t()
end
"""
@callback validate_submission(map()) :: :ok | {:error, term()}
defmacro __using__(opts) do
task_type = Keyword.fetch!(opts, :task_type)
commands_module = Keyword.get(opts, :commands, WorkloadService.Commands.Task)
submission_type = Keyword.get(opts, :submission_type, quote(do: map()))
quote do
@type t :: %__MODULE__{
id: WorkloadService.Aggregates.TaskId.t() | nil,
application_id: WorkloadService.Aggregates.ApplicationId.t() | nil,
task_info: map() | nil,
submission: unquote(submission_type) | nil,
attachments: [String.t()],
status: String.t() | nil
}
@behaviour Commanded.Aggregates.Aggregate
@task_type unquote(task_type)