« get me outta code hell

content: artwork chronology links - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/linkArtwork.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-03-31 17:45:29 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-10 16:02:37 -0300
commitec8c79787ab330986e9da590fd500c7ceda893f2 (patch)
tree311920108f22fcf1f8de178f4f7efd654e0f6abc /src/content/dependencies/linkArtwork.js
parent963c84f1bb9fd88cc0873dd6da77da1896c6b5ea (diff)
content: artwork chronology links
Diffstat (limited to 'src/content/dependencies/linkArtwork.js')
-rw-r--r--src/content/dependencies/linkArtwork.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/content/dependencies/linkArtwork.js b/src/content/dependencies/linkArtwork.js
new file mode 100644
index 00000000..8cd6f359
--- /dev/null
+++ b/src/content/dependencies/linkArtwork.js
@@ -0,0 +1,20 @@
+export default {
+  contentDependencies: ['linkAlbum', 'linkTrack'],
+
+  query: (artwork) => ({
+    referenceType:
+      artwork.thing.constructor[Symbol.for('Thing.referenceType')],
+  }),
+
+  relations: (relation, query, artwork) => ({
+    link:
+      (query.referenceType === 'album'
+        ? relation('linkAlbum', artwork.thing)
+     : query.referenceType === 'track'
+        ? relation('linkTrack', artwork.thing)
+        : null),
+  }),
+
+  generate: (relations) =>
+    relations.link,
+};