« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data/things/artist.js31
1 files changed, 9 insertions, 22 deletions
diff --git a/src/data/things/artist.js b/src/data/things/artist.js
index 66a7346b..f7813b97 100644
--- a/src/data/things/artist.js
+++ b/src/data/things/artist.js
@@ -9,6 +9,7 @@ import {
   flag,
   name,
   reverseContributionList,
+  reverseReferenceList,
   singleReference,
   urls,
   wikiData,
@@ -126,17 +127,10 @@ export class Artist extends Thing {
       },
     ],
 
-    tracksAsCommentator: {
-      flags: {expose: true},
-
-      expose: {
-        dependencies: ['this', 'trackData'],
-
-        compute: ({this: artist, trackData}) =>
-          trackData?.filter(({commentatorArtists}) =>
-            commentatorArtists.includes(artist)) ?? [],
-      },
-    },
+    tracksAsCommentator: reverseReferenceList({
+      data: 'trackData',
+      list: input.value('commentatorArtists'),
+    }),
 
     albumsAsAlbumArtist: reverseContributionList({
       data: 'albumData',
@@ -210,17 +204,10 @@ export class Artist extends Thing {
       },
     ],
 
-    albumsAsCommentator: {
-      flags: {expose: true},
-
-      expose: {
-        dependencies: ['this', 'albumData'],
-
-        compute: ({this: artist, albumData}) =>
-          albumData?.filter(({commentatorArtists}) =>
-            commentatorArtists.includes(artist)) ?? [],
-      },
-    },
+    albumsAsCommentator: reverseReferenceList({
+      data: 'albumData',
+      list: input.value('commentatorArtists'),
+    }),
 
     flashesAsContributor: reverseContributionList({
       data: 'flashData',