« get me outta code hell

additionalFiles.js « wiki-properties « composite « data « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/wiki-properties/additionalFiles.js
blob: 6760527a84f79c3c9fc8dbab206ee9380ecbc918 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// 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: [...]},
//     ...
//   ]
//

import {isAdditionalFileList} from '#validators';

// TODO: Not templateCompositeFrom.

export default function() {
  return {
    flags: {update: true, expose: true},
    update: {validate: isAdditionalFileList},
    expose: {
      transform: (additionalFiles) =>
        additionalFiles ?? [],
    },
  };
}