add dialyzer and fix id
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user