commit f12d37c6b3ef67a91589edbe9c7af565c1e3994c
parent 6d3f2aee24ea2f668402c48a28e316dd067596bf
Author: srfsh <dev@srf.sh>
Date: Tue, 13 Dec 2022 20:40:38 +0300
Zenflows.VF.Proposal.{Resolv,Type}: expose the state field
Diffstat:
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/src/zenflows/vf/proposal/resolv.ex b/src/zenflows/vf/proposal/resolv.ex
@@ -93,4 +93,8 @@ def reciprocal_intents(prop, _, _) do
prop = Domain.preload(prop, :reciprocal_intents)
{:ok, prop.reciprocal_intents}
end
+
+def state(prop, _, _) do
+ {:ok, Domain.state(prop)}
+end
end
diff --git a/src/zenflows/vf/proposal/type.ex b/src/zenflows/vf/proposal/type.ex
@@ -37,6 +37,13 @@ create commitments; commonly seen in a price list or e-commerce.
@eligible_location "The location at which this proposal is eligible."
@eligible_location_id "(`SpatialThing`) #{@eligible_location}"
+@desc "The state of the proposal: pending, accepted, or refused."
+enum :proposed_state do
+ value :pending
+ value :accepted
+ value :refused
+end
+
@desc """
Published requests or offers, sometimes with what is expected in return.
"""
@@ -72,6 +79,9 @@ object :proposal do
field :reciprocal_intents, list_of(non_null(:intent)),
resolve: &Resolv.reciprocal_intents/3
+
+ field :state, non_null(:proposed_state),
+ resolve: &Resolv.state/3
end
input_object :proposal_create_params do