« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/things.js')
-rw-r--r--src/data/things.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/data/things.js b/src/data/things.js
index 0695b0d..80e22e3 100644
--- a/src/data/things.js
+++ b/src/data/things.js
@@ -4,6 +4,7 @@
 import CacheableObject from './cacheable-object.js';
 
 import {
+    isAdditionalFileList,
     isBoolean,
     isColor,
     isCommentary,
@@ -207,6 +208,26 @@ Thing.common = {
         update: {validate: isCommentary}
     }),
 
+    // This is a somewhat more involved data structure - it's for additional
+    // or "bonus" files associated with albums or tracks (or anything else).
+    // It's got this form:
+    //
+    //     [
+    //         {title: 'Booklet', files: ['Booklet.pdf']},
+    //         {
+    //             title: 'Wallpaper',
+    //             description: 'Cool Wallpaper!',
+    //             files: ['1440x900.png', '1920x1080.png']
+    //         },
+    //         {title: 'Alternate Covers', description: null, files: [...]},
+    //         ...
+    //     ]
+    //
+    additionalFiles: () => ({
+        flags: {update: true, expose: true},
+        update: {validate: isAdditionalFileList}
+    }),
+
     // A reference list! Keep in mind this is for general references to wiki
     // objects of (usually) other Thing subclasses, not specifically leitmotif
     // references in tracks (although that property uses referenceList too!).
@@ -497,6 +518,7 @@ Album.propertyDescriptors = {
     isListedOnHomepage: Thing.common.flag(true),
 
     commentary: Thing.common.commentary(),
+    additionalFiles: Thing.common.additionalFiles(),
 
     // Update only
 
@@ -566,6 +588,7 @@ Album[S.serializeDescriptors] = {
     isListedOnHomepage: S.id,
 
     commentary: S.id,
+    additionalFiles: S.id,
 
     tracks: S.toRefs,
     groups: S.toRefs,
@@ -712,6 +735,7 @@ Track.propertyDescriptors = {
 
     commentary: Thing.common.commentary(),
     lyrics: Thing.common.simpleString(),
+    additionalFiles: Thing.common.additionalFiles(),
 
     // Update only