mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-03 02:35:52 +03:00
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:
parent
03ad1b8510
commit
9430c8c5ab
@ -279,7 +279,10 @@
|
||||
=/ metadatum=(unit metadatum:metadata)
|
||||
(peek-metadatum:met %graph rid)
|
||||
?~ 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
|
||||
|
@ -64,6 +64,21 @@
|
||||
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
|
||||
$: group-indices=(jug resource md-resource:store)
|
||||
app-indices=(jug app-name:store [group=resource =resource])
|
||||
@ -71,6 +86,11 @@
|
||||
==
|
||||
::
|
||||
+$ base-state-2
|
||||
$: associations=associations-2
|
||||
~
|
||||
==
|
||||
::
|
||||
+$ base-state-3
|
||||
$: =associations:store
|
||||
~
|
||||
==
|
||||
@ -83,6 +103,7 @@
|
||||
+$ state-5 [%5 base-state-1]
|
||||
+$ state-6 [%6 base-state-1]
|
||||
+$ state-7 [%7 base-state-2]
|
||||
+$ state-8 [%8 base-state-3]
|
||||
+$ versioned-state
|
||||
$% state-0
|
||||
state-1
|
||||
@ -92,10 +113,11 @@
|
||||
state-5
|
||||
state-6
|
||||
state-7
|
||||
state-8
|
||||
==
|
||||
::
|
||||
+$ inflated-state
|
||||
$: state-7
|
||||
$: state-8
|
||||
cached-indices
|
||||
==
|
||||
--
|
||||
@ -208,21 +230,16 @@
|
||||
=| cards=(list card)
|
||||
|^
|
||||
=* loop $
|
||||
?: ?=(%7 -.old)
|
||||
?: ?=(%8 -.old)
|
||||
:- cards
|
||||
%_ state
|
||||
associations
|
||||
associations.old
|
||||
::
|
||||
resource-indices
|
||||
(rebuild-resource-indices associations.old)
|
||||
::
|
||||
group-indices
|
||||
(rebuild-group-indices associations.old)
|
||||
::
|
||||
app-indices
|
||||
(rebuild-app-indices associations.old)
|
||||
associations associations.old
|
||||
resource-indices (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)
|
||||
=/ old-assoc=associations-1
|
||||
(migrate-app-to-graph-store %chat associations.old)
|
||||
@ -236,12 +253,36 @@
|
||||
associations.old associations
|
||||
==
|
||||
:: 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
|
||||
|= assoc=associations-1
|
||||
^- associations:store
|
||||
%- ~(gas by *associations:store)
|
||||
^- associations-2
|
||||
%- ~(gas by *associations-2)
|
||||
%+ murn
|
||||
~(tap by assoc)
|
||||
|= [[group=path m=md-resource-1] met=metadata-1]
|
||||
@ -324,7 +365,7 @@
|
||||
^- (quip card _state)
|
||||
|^
|
||||
=^ cards state
|
||||
(on-load !>([%7 (remake-metadata ;;(tree-metadata +.arc))]))
|
||||
(on-load !>([%8 (remake-metadata ;;(tree-metadata +.arc))]))
|
||||
:_ state
|
||||
%+ weld cards
|
||||
%+ turn ~(tap in ~(key by group-indices))
|
||||
@ -348,7 +389,7 @@
|
||||
::
|
||||
++ remake-metadata
|
||||
|= tm=tree-metadata
|
||||
^- base-state-2
|
||||
^- base-state-3
|
||||
:* (remake-map associations.tm)
|
||||
~
|
||||
==
|
||||
|
@ -46,7 +46,19 @@
|
||||
[%color s+(scot %ux color.met)]
|
||||
[%date-created s+(scot %da date-created.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]
|
||||
[%preview b+preview.met]
|
||||
[%vip s+`@t`vip.met]
|
||||
@ -156,12 +168,32 @@
|
||||
[%color nu]
|
||||
[%date-created (se %da)]
|
||||
[%creator (su ;~(pfix sig fed:ag))]
|
||||
[%module so]
|
||||
[%module module]
|
||||
[%picture so]
|
||||
[%preview bo]
|
||||
[%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
|
||||
^- $-(json ^md-resource)
|
||||
%- ot
|
||||
|
@ -34,7 +34,7 @@
|
||||
=color
|
||||
date-created=time
|
||||
creator=ship
|
||||
module=term
|
||||
module=(each term (unit (unit md-resource)))
|
||||
picture=url
|
||||
preview=?
|
||||
vip=vip-metadata
|
||||
|
Loading…
Reference in New Issue
Block a user