commit d235fbc613cfb47824af6ff64e7373c95dbab9f3
parent 906c906bf96dac3764ace19a209e8483f54820db
Author: srfsh <dev@srf.sh>
Date: Thu, 20 Oct 2022 16:51:37 +0300
Zenflows.VF.EconomicEvent: permit :classified_as in transfer{,AllRights,Custody} and move events
Diffstat:
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/zenflows/vf/economic_event.ex b/src/zenflows/vf/economic_event.ex
@@ -253,21 +253,30 @@ end
defp do_chgset("transferAllRights", schema, params) do
schema
- |> Changeset.cast(params, ~w[resource_inventoried_as_id to_resource_inventoried_as_id resource_quantity]a)
+ |> Changeset.cast(params, ~w[
+ resource_inventoried_as_id to_resource_inventoried_as_id
+ resource_quantity resource_classified_as
+ ]a)
|> Changeset.validate_required(~w[resource_inventoried_as_id resource_quantity]a)
|> Measure.cast(:resource_quantity)
end
defp do_chgset(action, schema, params) when action in ~w[transferCustody transfer] do
schema
- |> Changeset.cast(params, ~w[resource_inventoried_as_id to_resource_inventoried_as_id resource_quantity to_location_id]a)
+ |> Changeset.cast(params, ~w[
+ resource_inventoried_as_id to_resource_inventoried_as_id resource_quantity
+ to_location_id resource_classified_as
+ ]a)
|> Changeset.validate_required(~w[resource_inventoried_as_id resource_quantity]a)
|> Measure.cast(:resource_quantity)
end
defp do_chgset("move", schema, params) do
schema
- |> Changeset.cast(params, ~w[resource_inventoried_as_id to_resource_inventoried_as_id resource_quantity to_location_id]a)
+ |> Changeset.cast(params, ~w[
+ resource_inventoried_as_id to_resource_inventoried_as_id resource_quantity
+ to_location_id resource_classified_as
+ ]a)
|> Changeset.validate_required(~w[resource_inventoried_as_id resource_quantity]a)
|> Measure.cast(:resource_quantity)
|> require_agents_same()