shrub/pkg/arvo/lib/group-view.hoon

111 lines
2.2 KiB
Plaintext
Raw Normal View History

2021-02-01 06:43:40 +03:00
/- sur=group-view, spider
/+ resource, strandio, metadata=metadata-store, store=group-store
2021-01-29 07:52:56 +03:00
^?
=< [. sur]
=, sur
|%
++ dejs
=, dejs:format
|%
++ action
^- $-(json ^action)
2021-01-29 07:52:56 +03:00
%- of
:~ create+create
remove+remove
join+join
leave+leave
2021-02-03 02:49:29 +03:00
invite+invite
2021-03-04 05:54:37 +03:00
hide+dejs-path:resource
2021-01-29 07:52:56 +03:00
==
::
++ create
%- ot
:~ name+so
policy+policy:dejs:store
title+so
description+so
==
::
++ remove dejs:resource
::
++ leave dejs:resource
::
2021-01-29 07:52:56 +03:00
++ join
%- ot
:~ resource+dejs:resource
ship+(su ;~(pfix sig fed:ag))
2021-01-29 07:52:56 +03:00
==
2021-02-03 02:49:29 +03:00
::
++ invite
%- ot
:~ resource+dejs:resource
ships+(as (su ;~(pfix sig fed:ag)))
description+so
==
2021-01-29 07:52:56 +03:00
--
::
++ enjs
=, enjs:format
|%
++ update
|= upd=^update
%+ frond %group-view-update
%+ frond -.upd
?- -.upd
%initial (initial +.upd)
%progress (progress +.upd)
2021-03-29 03:29:47 +03:00
%started (started +.upd)
2021-03-04 05:54:37 +03:00
%hide s+(enjs-path:resource +.upd)
2021-01-29 07:52:56 +03:00
==
::
2021-03-29 03:29:47 +03:00
++ started
|= [rid=resource req=^request]
%- pairs
:~ resource+s+(enjs-path:resource rid)
request+(request req)
==
::
2021-01-29 07:52:56 +03:00
++ progress
|= [rid=resource prog=^progress]
%- pairs
:~ resource+s+(enjs-path:resource rid)
progress+s+prog
==
2021-03-04 05:54:37 +03:00
++ request
|= req=^request
%- pairs
:~ hidden+b+hidden.req
started+(time started.req)
ship+(ship ship.req)
progress+s+progress.req
==
2021-01-29 07:52:56 +03:00
::
++ initial
2021-03-04 05:54:37 +03:00
|= init=(map resource ^request)
%- pairs
%+ turn ~(tap by init)
2021-03-04 05:54:37 +03:00
|= [rid=resource req=^request]
:_ (request req)
(enjs-path:resource rid)
2021-01-29 07:52:56 +03:00
--
2021-02-01 06:43:40 +03:00
++ cleanup-md
|= rid=resource
=/ m (strand:spider ,~)
^- form:m
;< =associations:metadata bind:m
%+ scry:strandio associations:metadata
%+ weld /gx/metadata-store/group
2021-02-01 06:43:40 +03:00
(snoc (en-path:resource rid) %noun)
~& associations
2021-02-01 06:43:40 +03:00
=/ assocs=(list [=md-resource:metadata association:metadata])
~(tap by associations)
|-
=* loop $
?~ assocs
(pure:m ~)
;< ~ bind:m
%+ poke-our:strandio %metadata-store
metadata-action+!>([%remove rid md-resource.i.assocs])
loop(assocs t.assocs)
2021-01-29 07:52:56 +03:00
--