« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
Diffstat (limited to 'src/data')
-rw-r--r--src/data/things/art-tag.js17
-rw-r--r--src/data/yaml.js8
2 files changed, 23 insertions, 2 deletions
diff --git a/src/data/things/art-tag.js b/src/data/things/art-tag.js
index 1266a4e0..f6798214 100644
--- a/src/data/things/art-tag.js
+++ b/src/data/things/art-tag.js
@@ -1,6 +1,7 @@
 import {input} from '#composite';
-import {sortAlbumsTracksChronologically} from '#wiki-data';
+import find from '#find';
 import {isName} from '#validators';
+import {sortAlbumsTracksChronologically} from '#wiki-data';
 
 import {exposeUpdateValueOrContinue} from '#composite/control-flow';
 
@@ -8,6 +9,8 @@ import {
   color,
   directory,
   flag,
+  referenceList,
+  reverseReferenceList,
   name,
   wikiData,
 } from '#composite/wiki-properties';
@@ -37,9 +40,16 @@ export class ArtTag extends Thing {
       },
     ],
 
+    directDescendantTags: referenceList({
+      class: input.value(ArtTag),
+      find: input.value(find.artTag),
+      data: 'artTagData',
+    }),
+
     // Update only
 
     albumData: wikiData(Album),
+    artTagData: wikiData(ArtTag),
     trackData: wikiData(Track),
 
     // Expose only
@@ -56,5 +66,10 @@ export class ArtTag extends Thing {
             {getDate: o => o.coverArtDate}),
       },
     },
+
+    directAncestorTags: reverseReferenceList({
+      data: 'artTagData',
+      list: input.value('directDescendantTags'),
+    }),
   });
 }
diff --git a/src/data/yaml.js b/src/data/yaml.js
index c799be5f..8a5cb2ca 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -462,6 +462,8 @@ export const processArtTagDocument = makeProcessDocument(T.ArtTag, {
 
     color: 'Color',
     isContentWarning: 'Is CW',
+
+    directDescendantTags: 'Direct Descendant Tags',
   },
 });
 
@@ -1359,7 +1361,7 @@ export function linkWikiDataArrays(wikiData, {
   assignWikiData(WD.groupCategoryData, 'groupData');
   assignWikiData(WD.flashData, 'artistData', 'flashActData', 'trackData');
   assignWikiData(WD.flashActData, 'flashData');
-  assignWikiData(WD.artTagData, 'albumData', 'trackData');
+  assignWikiData(WD.artTagData, 'albumData', 'artTagData', 'trackData');
   assignWikiData(WD.homepageLayout?.rows, 'albumData', 'groupData');
 }
 
@@ -1477,6 +1479,10 @@ export function filterReferenceErrors(wikiData) {
       artTags: 'artTag',
     }],
 
+    ['artTagData', processArtTagDocument, {
+      directDescendantTags: 'artTag',
+    }],
+
     ['trackData', processTrackDocument, {
       artistContribs: '_contrib',
       contributorContribs: '_contrib',