« 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/things/flash.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/things/flash.js')
-rw-r--r--src/data/things/flash.js50
1 files changed, 40 insertions, 10 deletions
diff --git a/src/data/things/flash.js b/src/data/things/flash.js
index 8a3fc374..b143b560 100644
--- a/src/data/things/flash.js
+++ b/src/data/things/flash.js
@@ -30,6 +30,7 @@ import {
   referenceList,
   simpleDate,
   soupyFind,
+  soupyReverse,
   thing,
   urls,
   wikiData,
@@ -115,11 +116,7 @@ export class Flash extends Thing {
     // Update only
 
     find: soupyFind(),
-
-    // used for withFlashAct (reverse)
-    flashActData: wikiData({
-      class: input.value(FlashAct),
-    }),
+    reverse: soupyReverse(),
 
     // used for withMatchingContributionPresets (indirectly by Contribution)
     wikiInfo: thing({
@@ -167,6 +164,25 @@ export class Flash extends Thing {
     },
   };
 
+  static [Thing.reverseSpecs] = {
+    flashesWhichFeature: {
+      bindTo: 'flashData',
+
+      referencing: flash => [flash],
+      referenced: flash => flash.featuredTracks,
+    },
+
+    flashContributorContributionsBy:
+      soupyReverse.contributionsBy('flashData', 'contributorContribs'),
+
+    flashesWithCommentaryBy: {
+      bindTo: 'flashData',
+
+      referencing: flash => [flash],
+      referenced: flash => flash.commentatorArtists,
+    },
+  };
+
   static [Thing.yamlDocumentSpec] = {
     fields: {
       'Flash': {property: 'name'},
@@ -242,11 +258,7 @@ export class FlashAct extends Thing {
     // Update only
 
     find: soupyFind(),
-
-    // used for withFlashSide
-    flashSideData: wikiData({
-      class: input.value(FlashSide),
-    }),
+    reverse: soupyReverse(),
 
     // Expose only
 
@@ -263,6 +275,15 @@ export class FlashAct extends Thing {
     },
   };
 
+  static [Thing.reverseSpecs] = {
+    flashActsWhoseFlashesInclude: {
+      bindTo: 'flashActData',
+
+      referencing: flashAct => [flashAct],
+      referenced: flashAct => flashAct.flashes,
+    },
+  };
+
   static [Thing.yamlDocumentSpec] = {
     fields: {
       'Act': {property: 'name'},
@@ -314,6 +335,15 @@ export class FlashSide extends Thing {
     },
   };
 
+  static [Thing.reverseSpecs] = {
+    flashSidesWhoseActsInclude: {
+      bindTo: 'flashSideData',
+
+      referencing: flashSide => [flashSide],
+      referenced: flashSide => flashSide.acts,
+    },
+  };
+
   static [Thing.getYamlLoadingSpec] = ({
     documentModes: {allInOne},
     thingConstructors: {Flash, FlashAct},