« get me outta code hell

data: Artwork.referencedByArtworks: restore {artwork, annotation} - 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-04-10 14:42:19 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-10 16:02:44 -0300
commit8424a3d380284f2e26b6057a500a69e53dc0b757 (patch)
tree4b7263b7c0479d6cedc3467839f2e72ba5de303e /src/data
parent738c4e3003f578d628d2d040ec17b9624f3ab322 (diff)
data: Artwork.referencedByArtworks: restore {artwork, annotation}
Diffstat (limited to 'src/data')
-rw-r--r--src/data/things/artwork.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/data/things/artwork.js b/src/data/things/artwork.js
index 93f238f2..ae0e1ecf 100644
--- a/src/data/things/artwork.js
+++ b/src/data/things/artwork.js
@@ -300,9 +300,22 @@ export class Artwork extends Thing {
     artworksWhichReference: {
       bindTo: 'artworkData',
 
-      referencing: artwork => [artwork],
-      referenced: artwork =>
-        artwork.referencedArtworks.map(ref => ref.artwork),
+      referencing: referencingArtwork =>
+        referencingArtwork.referencedArtworks
+          .map(({artwork: referencedArtwork, ...referenceDetails}) => ({
+            referencingArtwork,
+            referencedArtwork,
+            referenceDetails,
+          })),
+
+      referenced: ({referencedArtwork}) => [referencedArtwork],
+
+      tidy: ({referencingArtwork, referenceDetails}) => ({
+        artwork: referencingArtwork,
+        ...referenceDetails,
+      }),
+
+      date: ({artwork}) => artwork.date,
     },
   };