« 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
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/album.js22
-rw-r--r--src/data/things/art-tag.js2
-rw-r--r--src/data/things/artist.js14
-rw-r--r--src/data/things/contribution.js6
-rw-r--r--src/data/things/flash.js28
-rw-r--r--src/data/things/group.js23
-rw-r--r--src/data/things/homepage-layout.js20
-rw-r--r--src/data/things/track.js24
-rw-r--r--src/data/things/wiki-info.js11
9 files changed, 55 insertions, 95 deletions
diff --git a/src/data/things/album.js b/src/data/things/album.js
index dbc3ca5b..1f789306 100644
--- a/src/data/things/album.js
+++ b/src/data/things/album.js
@@ -230,8 +230,7 @@ export class Album extends Thing {
 
     groups: referenceList({
       class: input.value(Group),
-      find: input.value(find.group),
-      data: 'groupData',
+      find: soupyFind.input('group'),
     }),
 
     artTags: [
@@ -242,8 +241,7 @@ export class Album extends Thing {
 
       referenceList({
         class: input.value(ArtTag),
-        find: input.value(find.artTag),
-        data: 'artTagData',
+        find: soupyFind.input('artTag'),
       }),
     ],
 
@@ -273,26 +271,17 @@ export class Album extends Thing {
 
     find: soupyFind(),
 
+    // used for referencedArtworkList (mixedFind)
     albumData: wikiData({
       class: input.value(Album),
     }),
 
-    artistData: wikiData({
-      class: input.value(Artist),
-    }),
-
-    artTagData: wikiData({
-      class: input.value(ArtTag),
-    }),
-
-    groupData: wikiData({
-      class: input.value(Group),
-    }),
-
+    // used for referencedArtworkList (mixedFind)
     trackData: wikiData({
       class: input.value(Track),
     }),
 
+    // used for withMatchingContributionPresets (indirectly by Contribution)
     wikiInfo: thing({
       class: input.value(WikiInfo),
     }),
@@ -643,6 +632,7 @@ export class TrackSection extends Thing {
 
     // Update only
 
+    // used for withAlbum
     albumData: wikiData({
       class: input.value(Album),
     }),
diff --git a/src/data/things/art-tag.js b/src/data/things/art-tag.js
index 3149b310..b7d79e8c 100644
--- a/src/data/things/art-tag.js
+++ b/src/data/things/art-tag.js
@@ -41,10 +41,12 @@ export class ArtTag extends Thing {
 
     // Update only
 
+    // used for taggedInThings (reverse)
     albumData: wikiData({
       class: input.value(Album),
     }),
 
+    // used for taggedInThings (reverse)
     trackData: wikiData({
       class: input.value(Track),
     }),
diff --git a/src/data/things/artist.js b/src/data/things/artist.js
index 8fdb8a12..64487dd0 100644
--- a/src/data/things/artist.js
+++ b/src/data/things/artist.js
@@ -25,6 +25,7 @@ import {
   reverseContributionList,
   reverseReferenceList,
   singleReference,
+  soupyFind,
   urls,
   wikiData,
 } from '#composite/wiki-properties';
@@ -57,28 +58,29 @@ export class Artist extends Thing {
 
     aliasedArtist: singleReference({
       class: input.value(Artist),
-      find: input.value(find.artist),
-      data: 'artistData',
+      find: soupyFind.input('artist'),
     }),
 
     // Update only
 
+    find: soupyFind(),
+
+    // used for reverse contribution lists
     albumData: wikiData({
       class: input.value(Album),
     }),
 
-    artistData: wikiData({
-      class: input.value(Artist),
-    }),
-
+    // used for reverse contribution lists
     flashData: wikiData({
       class: input.value(Flash),
     }),
 
+    // used for closelyLinkedGroups
     groupData: wikiData({
       class: input.value(Group),
     }),
 
+    // used for reverse contribution lists
     trackData: wikiData({
       class: input.value(Track),
     }),
diff --git a/src/data/things/contribution.js b/src/data/things/contribution.js
index 2712af70..5b6a4496 100644
--- a/src/data/things/contribution.js
+++ b/src/data/things/contribution.js
@@ -9,7 +9,7 @@ import {isStringNonEmpty, isThing, validateReference} from '#validators';
 
 import {exitWithoutDependency, exposeDependency} from '#composite/control-flow';
 import {withResolvedReference} from '#composite/wiki-data';
-import {flag, simpleDate} from '#composite/wiki-properties';
+import {flag, simpleDate, soupyFind} from '#composite/wiki-properties';
 
 import {
   withFilteredList,
@@ -82,6 +82,10 @@ export class Contribution extends Thing {
       flag(true),
     ],
 
+    // Update only
+
+    find: soupyFind(),
+
     // Expose only
 
     context: [
diff --git a/src/data/things/flash.js b/src/data/things/flash.js
index bd995035..a681e013 100644
--- a/src/data/things/flash.js
+++ b/src/data/things/flash.js
@@ -106,8 +106,7 @@ export class Flash extends Thing {
 
     featuredTracks: referenceList({
       class: input.value(Track),
-      find: input.value(find.track),
-      data: 'trackData',
+      find: soupyFind.input('track'),
     }),
 
     urls: urls(),
@@ -119,18 +118,12 @@ export class Flash extends Thing {
 
     find: soupyFind(),
 
-    artistData: wikiData({
-      class: input.value(Artist),
-    }),
-
-    trackData: wikiData({
-      class: input.value(Track),
-    }),
-
+    // used for withFlashAct (reverse)
     flashActData: wikiData({
       class: input.value(FlashAct),
     }),
 
+    // used for withMatchingContributionPresets (indirectly by Contribution)
     wikiInfo: thing({
       class: input.value(WikiInfo),
     }),
@@ -245,18 +238,14 @@ export class FlashAct extends Thing {
 
     flashes: referenceList({
       class: input.value(Flash),
-      find: input.value(find.flash),
-      data: 'flashData',
+      find: soupyFind.input('flash'),
     }),
 
     // Update only
 
     find: soupyFind(),
 
-    flashData: wikiData({
-      class: input.value(Flash),
-    }),
-
+    // used for withFlashSide
     flashSideData: wikiData({
       class: input.value(FlashSide),
     }),
@@ -303,17 +292,12 @@ export class FlashSide extends Thing {
 
     acts: referenceList({
       class: input.value(FlashAct),
-      find: input.value(find.flashAct),
-      data: 'flashActData',
+      find: soupyFind.input('flashAct'),
     }),
 
     // Update only
 
     find: soupyFind(),
-
-    flashActData: wikiData({
-      class: input.value(FlashAct),
-    }),
   });
 
   static [Thing.yamlDocumentSpec] = {
diff --git a/src/data/things/group.js b/src/data/things/group.js
index 8418cb99..ffcc287c 100644
--- a/src/data/things/group.js
+++ b/src/data/things/group.js
@@ -13,6 +13,7 @@ import {
   name,
   referenceList,
   seriesList,
+  soupyFind,
   urls,
   wikiData,
 } from '#composite/wiki-properties';
@@ -32,8 +33,7 @@ export class Group extends Thing {
 
     closelyLinkedArtists: annotatedReferenceList({
       class: input.value(Artist),
-      find: input.value(find.artist),
-      data: 'artistData',
+      find: soupyFind.input('artist'),
 
       date: input.value(null),
 
@@ -43,8 +43,7 @@ export class Group extends Thing {
 
     featuredAlbums: referenceList({
       class: input.value(Album),
-      find: input.value(find.album),
-      data: 'albumData',
+      find: soupyFind.input('album'),
     }),
 
     serieses: seriesList({
@@ -53,14 +52,15 @@ export class Group extends Thing {
 
     // Update only
 
+    find: soupyFind(),
+
+    // used for albums (reverse)
     albumData: wikiData({
       class: input.value(Album),
     }),
 
-    artistData: wikiData({
-      class: input.value(Artist),
-    }),
-
+    // used for category (reverse)
+    // used for color (reverse)
     groupCategoryData: wikiData({
       class: input.value(GroupCategory),
     }),
@@ -210,15 +210,12 @@ export class GroupCategory extends Thing {
 
     groups: referenceList({
       class: input.value(Group),
-      find: input.value(find.group),
-      data: 'groupData',
+      find: soupyFind.input('group'),
     }),
 
     // Update only
 
-    groupData: wikiData({
-      class: input.value(Group),
-    }),
+    find: soupyFind(),
   });
 
   static [Thing.yamlDocumentSpec] = {
diff --git a/src/data/things/homepage-layout.js b/src/data/things/homepage-layout.js
index 00d6aef5..52be1b11 100644
--- a/src/data/things/homepage-layout.js
+++ b/src/data/things/homepage-layout.js
@@ -17,7 +17,7 @@ import {
 
 import {exposeDependency} from '#composite/control-flow';
 import {withResolvedReference} from '#composite/wiki-data';
-import {color, contentString, name, referenceList, wikiData}
+import {color, contentString, name, referenceList, soupyFind}
   from '#composite/wiki-properties';
 
 export class HomepageLayout extends Thing {
@@ -74,17 +74,7 @@ export class HomepageLayoutRow extends Thing {
 
     // Update only
 
-    // These wiki data arrays aren't necessarily used by every subclass, but
-    // to the convenience of providing these, the superclass accepts all wiki
-    // data arrays depended upon by any subclass.
-
-    albumData: wikiData({
-      class: input.value(Album),
-    }),
-
-    groupData: wikiData({
-      class: input.value(Group),
-    }),
+    find: soupyFind(),
   });
 
   static [Thing.yamlDocumentSpec] = {
@@ -151,8 +141,7 @@ export class HomepageLayoutAlbumsRow extends HomepageLayoutRow {
 
       withResolvedReference({
         ref: input.updateValue(),
-        data: 'groupData',
-        find: input.value(find.group),
+        find: soupyFind.input('group'),
       }),
 
       exposeDependency({dependency: '#resolvedReference'}),
@@ -160,8 +149,7 @@ export class HomepageLayoutAlbumsRow extends HomepageLayoutRow {
 
     sourceAlbums: referenceList({
       class: input.value(Album),
-      find: input.value(find.album),
-      data: 'albumData',
+      find: soupyFind.input('album'),
     }),
 
     countAlbumsFromGroup: {
diff --git a/src/data/things/track.js b/src/data/things/track.js
index d88f366c..4662be89 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -222,8 +222,7 @@ export class Track extends Thing {
 
     originalReleaseTrack: singleReference({
       class: input.value(Track),
-      find: input.value(find.track),
-      data: 'trackData',
+      find: soupyFind.input('track'),
     }),
 
     // Internal use only - for directly identifying an album inside a track's
@@ -231,8 +230,7 @@ export class Track extends Thing {
     // included in an album's track list).
     dataSourceAlbum: singleReference({
       class: input.value(Album),
-      find: input.value(find.album),
-      data: 'albumData',
+      find: soupyFind.input('album'),
     }),
 
     artistContribs: [
@@ -354,8 +352,7 @@ export class Track extends Thing {
 
       referenceList({
         class: input.value(ArtTag),
-        find: input.value(find.artTag),
-        data: 'artTagData',
+        find: soupyFind.input('artTag'),
       }),
     ],
 
@@ -377,30 +374,29 @@ export class Track extends Thing {
 
     find: soupyFind(),
 
+    // used for referencedArtworkList (mixedFind)
+    // used for withAlbum (reverse)
     albumData: wikiData({
       class: input.value(Album),
     }),
 
-    artistData: wikiData({
-      class: input.value(Artist),
-    }),
-
-    artTagData: wikiData({
-      class: input.value(ArtTag),
-    }),
-
+    // used for featuredInFlashes (reverse)
     flashData: wikiData({
       class: input.value(Flash),
     }),
 
+    // used for referencedArtworkList (mixedFind)
+    // used for trackReverseReferenceList (reverse)
     trackData: wikiData({
       class: input.value(Track),
     }),
 
+    // used for withContainingTrackSection (reverse)
     trackSectionData: wikiData({
       class: input.value(TrackSection),
     }),
 
+    // used for withMatchingContributionPresets (indirectly by Contribution)
     wikiInfo: thing({
       class: input.value(WikiInfo),
     }),
diff --git a/src/data/things/wiki-info.js b/src/data/things/wiki-info.js
index ef643681..1a91ac5e 100644
--- a/src/data/things/wiki-info.js
+++ b/src/data/things/wiki-info.js
@@ -15,7 +15,7 @@ import {
 } from '#validators';
 
 import {exitWithoutDependency} from '#composite/control-flow';
-import {contentString, flag, name, referenceList, wikiData}
+import {contentString, flag, name, referenceList, soupyFind}
   from '#composite/wiki-properties';
 
 export class WikiInfo extends Thing {
@@ -71,8 +71,7 @@ export class WikiInfo extends Thing {
 
     divideTrackListsByGroups: referenceList({
       class: input.value(Group),
-      find: input.value(find.group),
-      data: 'groupData',
+      find: soupyFind.input('group'),
     }),
 
     contributionPresets: {
@@ -99,6 +98,8 @@ export class WikiInfo extends Thing {
 
     // Update only
 
+    find: soupyFind(),
+
     searchDataAvailable: {
       flags: {update: true},
       update: {
@@ -106,10 +107,6 @@ export class WikiInfo extends Thing {
         default: false,
       },
     },
-
-    groupData: wikiData({
-      class: input.value(Group),
-    }),
   });
 
   static [Thing.yamlDocumentSpec] = {