« get me outta code hell

content: linkAnythingMan - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-06-17 21:17:08 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-18 22:56:14 -0300
commitd2176d68113ed3bd409db35d2d2758b8e01bf6e3 (patch)
treeb88e6bb239071bc42e6e336ab48c2859d04d51ef /src/content/dependencies
parent5c5ffda914d9a7411932822366ed6aeaa71fe934 (diff)
content: linkAnythingMan
It lives!
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/linkAnythingMan.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/content/dependencies/linkAnythingMan.js b/src/content/dependencies/linkAnythingMan.js
new file mode 100644
index 00000000..d4697403
--- /dev/null
+++ b/src/content/dependencies/linkAnythingMan.js
@@ -0,0 +1,25 @@
+export default {
+  contentDependencies: [
+    'linkAlbum',
+    'linkFlash',
+    'linkTrack',
+  ],
+
+  query: (thing) => ({
+    referenceType: thing.constructor[Symbol.for('Thing.referenceType')],
+  }),
+
+  relations: (relation, query, thing) => ({
+    link:
+      (query.referenceType === 'album'
+        ? relation('linkAlbum', thing)
+     : query.referenceType === 'flash'
+        ? relation('linkFlash', thing)
+     : query.referenceType === 'track'
+        ? relation('linkTrack', thing)
+        : null),
+  }),
+
+  generate: (relations) =>
+    relations.link,
+};