« get me outta code hell

data: soupyReverse.artworkContributionsBy - 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:
author(quasar) nebula <qznebula@protonmail.com>2025-03-31 17:40:35 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-10 16:02:36 -0300
commit015989924eadd401ae5932d634109a2f6b801666 (patch)
treeba60ed97c763e0e9ae43172f74be33d8da083380 /src/data
parentf8a5593abfddc433890e0c8916d07698bb8c7279 (diff)
data: soupyReverse.artworkContributionsBy
Diffstat (limited to 'src/data')
-rw-r--r--src/data/composite/wiki-properties/soupyReverse.js12
-rw-r--r--src/data/things/album.js2
-rw-r--r--src/data/things/track.js2
3 files changed, 14 insertions, 2 deletions
diff --git a/src/data/composite/wiki-properties/soupyReverse.js b/src/data/composite/wiki-properties/soupyReverse.js
index 269ccd6f..a3171738 100644
--- a/src/data/composite/wiki-properties/soupyReverse.js
+++ b/src/data/composite/wiki-properties/soupyReverse.js
@@ -19,4 +19,16 @@ soupyReverse.contributionsBy =
     referenced: contrib => [contrib.artist],
   });
 
+soupyReverse.artworkContributionsBy =
+  (bindTo, artworkProperty) => ({
+    bindTo,
+
+    referencing: thing =>
+      (thing[artworkProperty]
+        ? thing[artworkProperty].artistContribs
+        : []),
+
+    referenced: contrib => [contrib.artist],
+  });
+
 export default soupyReverse;
diff --git a/src/data/things/album.js b/src/data/things/album.js
index 1c13ef16..4321635e 100644
--- a/src/data/things/album.js
+++ b/src/data/things/album.js
@@ -411,7 +411,7 @@ export class Album extends Thing {
       soupyReverse.contributionsBy('albumData', 'artistContribs'),
 
     albumCoverArtistContributionsBy:
-      soupyReverse.contributionsBy('albumData', 'coverArtistContribs'),
+      soupyReverse.artworkContributionsBy('albumData', 'coverArtwork'),
 
     albumWallpaperArtistContributionsBy:
       soupyReverse.contributionsBy('albumData', 'wallpaperArtistContribs'),
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 84e36d95..6954bda2 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -704,7 +704,7 @@ export class Track extends Thing {
       soupyReverse.contributionsBy('trackData', 'contributorContribs'),
 
     trackCoverArtistContributionsBy:
-      soupyReverse.contributionsBy('trackData', 'coverArtistContribs'),
+      soupyReverse.artworkContributionsBy('trackData', 'trackArtwork'),
 
     tracksWithCommentaryBy: {
       bindTo: 'trackData',