« get me outta code hell

data: fix commentary entry serialization - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-15 10:50:54 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-15 10:50:54 -0400
commitf2a31006efa7c4d9c7c15823adc70cc40c46dedd (patch)
treea8911456a624a9462ab436360d7322e9f6ea9f3e
parentf754a8d9187e435a761db31b5053aa2e7ba22e13 (diff)
data: fix commentary entry serialization
-rw-r--r--src/data/serialize.js4
-rw-r--r--src/data/things/album.js3
2 files changed, 6 insertions, 1 deletions
diff --git a/src/data/serialize.js b/src/data/serialize.js
index 52aacb07..8cac3309 100644
--- a/src/data/serialize.js
+++ b/src/data/serialize.js
@@ -19,6 +19,10 @@ export function toContribRefs(contribs) {
   return contribs?.map(({who, what}) => ({who: toRef(who), what}));
 }
 
+export function toCommentaryRefs(entries) {
+  return entries?.map(({artist, ...props}) => ({artist: toRef(artist), ...props}));
+}
+
 // Interface
 
 export const serializeDescriptors = Symbol();
diff --git a/src/data/things/album.js b/src/data/things/album.js
index af3eb042..63ec1140 100644
--- a/src/data/things/album.js
+++ b/src/data/things/album.js
@@ -181,7 +181,8 @@ export class Album extends Thing {
     hasTrackArt: S.id,
     isListedOnHomepage: S.id,
 
-    commentary: S.id,
+    commentary: S.toCommentaryRefs,
+
     additionalFiles: S.id,
 
     tracks: S.toRefs,