invite-json: first pass
/- *invite-store
+/+ resource
|%
++ slan |=(mod/@tas |=(txt/@ta (need (slaw mod txt))))
::
^- json
%- pairs:enjs:format
%+ turn ~(tap by inv)
- |= [=path =invitatory]
+ |= [=term =invitatory]
^- [cord json]
- [(spat path) (invitatory-to-json invitatory)]
+ [term (invitatory-to-json invitatory)]
::
++ invitatory-to-json
|= =invitatory
%- pairs
:~ [%ship (ship ship.invite)]
[%app [%s app.invite]]
- [%path (path path.invite)]
+ [%resource (enjs:resource resource.invite)]
[%recipient (ship recipient.invite)]
[%text [%s text.invite]]
==
[%initial (invites-to-json invites.upd)]
?: =(%create -.upd)
?> ?=(%create -.upd)
- [%create (pairs [%path (path path.upd)]~)]
+ [%create (pairs [%term s+term.upd]~)]
?: =(%delete -.upd)
?> ?=(%delete -.upd)
- [%delete (pairs [%path (path path.upd)]~)]
+ [%delete (pairs [%term s+term.upd]~)]
?: =(%accepted -.upd)
?> ?=(%accepted -.upd)
:- %accepted
%- pairs
- :~ [%path (path path.upd)]
+ :~ [%term s+term.upd]
[%uid s+(scot %uv uid.upd)]
[%invite (invite-to-json invite.upd)]
==
?> ?=(%decline -.upd)
:- %decline
%- pairs
- :~ [%path (path path.upd)]
+ :~ [%term s+term.upd]
[%uid s+(scot %uv uid.upd)]
==
?: =(%invite -.upd)
?> ?=(%invite -.upd)
:- %invite
%- pairs
- :~ [%path (path path.upd)]
+ :~ [%term s+term.upd]
[%uid s+(scot %uv uid.upd)]
[%invite (invite-to-json invite.upd)]
==
|%
++ parse-json
%- of
- :~ [%create create]
- [%delete delete]
+ :~ [%create so]
+ [%delete so]
[%invite invite]
[%accept accept]
[%decline decline]
==
::
- ++ create
- (ot [%path pa]~)
- ::
- ++ delete
- (ot [%path pa]~)
- ::
-
++ invite
%- ot
- :~ [%path pa]
+ :~ [%term so]
[%uid seri]
[%invite invi]
==
::
++ accept
%- ot
- :~ [%path pa]
+ :~ [%term so]
[%uid seri]
==
::
++ decline
%- ot
- :~ [%path pa]
+ :~ [%term so]
[%uid seri]
==
::
++ invi
%- ot
:~ [%ship (su ;~(pfix sig fed:ag))]
- [%app (se %tas)]
- [%path pa]
+ [%app so]
+ [%resource dejs:resource]
[%recipient (su ;~(pfix sig fed:ag))]
[%text so]
==
