metadata-store: modify module from @t to (each @t (unit (unit md-resource))) so as to allow for setting an optional group feed associated with a group

This commit is contained in:
Logan Allen 2021-03-05 14:28:46 -06:00
parent 03ad1b8510
commit 9430c8c5ab
4 changed files with 98 additions and 22 deletions

View File

@ -279,7 +279,10 @@
=/ metadatum=(unit metadatum:metadata) =/ metadatum=(unit metadatum:metadata)
(peek-metadatum:met %graph rid) (peek-metadatum:met %graph rid)
?~ metadatum `state ?~ metadatum `state
abet:check:(abed:handle-update:ha rid nodes u.group module.u.metadatum) =/ module=term
?. ?=(%& -.module.u.metadatum) %$
p.module.u.metadatum
abet:check:(abed:handle-update:ha rid nodes u.group module)
-- --
:: ::
++ on-peek on-peek:def ++ on-peek on-peek:def

View File

@ -64,6 +64,21 @@
resource-indices=(jug md-resource-1 path) resource-indices=(jug md-resource-1 path)
== ==
:: ::
+$ metadatum-2
$: title=cord
description=cord
=color:store
date-created=time
creator=ship
module=term
picture=url:store
preview=?
vip=vip-metadata:store
==
::
+$ association-2 [group=resource =metadatum-2]
+$ associations-2 (map md-resource:store association-2)
::
+$ cached-indices +$ cached-indices
$: group-indices=(jug resource md-resource:store) $: group-indices=(jug resource md-resource:store)
app-indices=(jug app-name:store [group=resource =resource]) app-indices=(jug app-name:store [group=resource =resource])
@ -71,6 +86,11 @@
== ==
:: ::
+$ base-state-2 +$ base-state-2
$: associations=associations-2
~
==
::
+$ base-state-3
$: =associations:store $: =associations:store
~ ~
== ==
@ -83,6 +103,7 @@
+$ state-5 [%5 base-state-1] +$ state-5 [%5 base-state-1]
+$ state-6 [%6 base-state-1] +$ state-6 [%6 base-state-1]
+$ state-7 [%7 base-state-2] +$ state-7 [%7 base-state-2]
+$ state-8 [%8 base-state-3]
+$ versioned-state +$ versioned-state
$% state-0 $% state-0
state-1 state-1
@ -92,10 +113,11 @@
state-5 state-5
state-6 state-6
state-7 state-7
state-8
== ==
:: ::
+$ inflated-state +$ inflated-state
$: state-7 $: state-8
cached-indices cached-indices
== ==
-- --
@ -208,21 +230,16 @@
=| cards=(list card) =| cards=(list card)
|^ |^
=* loop $ =* loop $
?: ?=(%7 -.old) ?: ?=(%8 -.old)
:- cards :- cards
%_ state %_ state
associations associations associations.old
associations.old resource-indices (rebuild-resource-indices associations.old)
:: group-indices (rebuild-group-indices associations.old)
resource-indices app-indices (rebuild-app-indices associations.old)
(rebuild-resource-indices associations.old)
::
group-indices
(rebuild-group-indices associations.old)
::
app-indices
(rebuild-app-indices associations.old)
== ==
?: ?=(%7 -.old)
$(old [%8 (associations-2-to-3 associations.old) ~])
?: ?=(%6 -.old) ?: ?=(%6 -.old)
=/ old-assoc=associations-1 =/ old-assoc=associations-1
(migrate-app-to-graph-store %chat associations.old) (migrate-app-to-graph-store %chat associations.old)
@ -236,12 +253,36 @@
associations.old associations associations.old associations
== ==
:: pre-breach, can safely throw away :: pre-breach, can safely throw away
loop(old *state-7) loop(old *state-8)
::
++ associations-2-to-3
|= assoc=associations-2
^- associations:store
%- ~(gas by *associations:store)
%+ turn ~(tap by assoc)
|= [m=md-resource:store [g=resource met=metadatum-2]]
[m [g (metadatum-2-to-3 met)]]
::
++ metadatum-2-to-3
|= m=metadatum-2
%* . *metadatum:store
title title.m
description description.m
color color.m
date-created date-created.m
creator creator.m
preview %.n
::
module
?: =(module.m %$)
[%| ~]
[%& module.m]
==
:: ::
++ associations-1-to-2 ++ associations-1-to-2
|= assoc=associations-1 |= assoc=associations-1
^- associations:store ^- associations-2
%- ~(gas by *associations:store) %- ~(gas by *associations-2)
%+ murn %+ murn
~(tap by assoc) ~(tap by assoc)
|= [[group=path m=md-resource-1] met=metadata-1] |= [[group=path m=md-resource-1] met=metadata-1]
@ -324,7 +365,7 @@
^- (quip card _state) ^- (quip card _state)
|^ |^
=^ cards state =^ cards state
(on-load !>([%7 (remake-metadata ;;(tree-metadata +.arc))])) (on-load !>([%8 (remake-metadata ;;(tree-metadata +.arc))]))
:_ state :_ state
%+ weld cards %+ weld cards
%+ turn ~(tap in ~(key by group-indices)) %+ turn ~(tap in ~(key by group-indices))
@ -348,7 +389,7 @@
:: ::
++ remake-metadata ++ remake-metadata
|= tm=tree-metadata |= tm=tree-metadata
^- base-state-2 ^- base-state-3
:* (remake-map associations.tm) :* (remake-map associations.tm)
~ ~
== ==

View File

@ -46,7 +46,19 @@
[%color s+(scot %ux color.met)] [%color s+(scot %ux color.met)]
[%date-created s+(scot %da date-created.met)] [%date-created s+(scot %da date-created.met)]
[%creator s+(scot %p creator.met)] [%creator s+(scot %p creator.met)]
[%module s+module.met] ::
:- %module
?: ?=(%& -.module.met)
s+p.module.met
?~ p.module.met
~
?~ u.p.module.met
o+~
%- pairs
:~ [%app-name s+app-name.u.u.p.module.met]
[%resource s+(enjs-path:resource resource.u.u.p.module.met)]
==
::
[%picture s+picture.met] [%picture s+picture.met]
[%preview b+preview.met] [%preview b+preview.met]
[%vip s+`@t`vip.met] [%vip s+`@t`vip.met]
@ -156,12 +168,32 @@
[%color nu] [%color nu]
[%date-created (se %da)] [%date-created (se %da)]
[%creator (su ;~(pfix sig fed:ag))] [%creator (su ;~(pfix sig fed:ag))]
[%module so] [%module module]
[%picture so] [%picture so]
[%preview bo] [%preview bo]
[%vip vip] [%vip vip]
== ==
:: ::
++ module
|= jon=^json
^- (each term (unit (unit ^md-resource)))
?~ jon
[%| ~]
?: ?=(%s -.jon)
[%& p.jon]
?> ?=(%o -.jon)
:+ %| ~
?. ?& (~(has by p.jon) 'app-name')
(~(has by p.jon) 'resource')
==
~
=/ app-name=^json (~(got by p.jon) 'app-name')
?> ?=(%s -.app-name)
:+ ~
p.app-name
=/ res=^json (~(got by p.jon) 'resource')
(dejs-path:resource res)
::
++ md-resource ++ md-resource
^- $-(json ^md-resource) ^- $-(json ^md-resource)
%- ot %- ot

View File

@ -34,7 +34,7 @@
=color =color
date-created=time date-created=time
creator=ship creator=ship
module=term module=(each term (unit (unit md-resource)))
picture=url picture=url
preview=? preview=?
vip=vip-metadata vip=vip-metadata