« get me outta code hell

linkAlbum.js « dependencies « content « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/linkAlbum.js
blob: 24b14e859a822341c9e9bf42d4b59bebd0742312 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
export default {
  relations: (relation, album) => ({
    link:
      (album.style === 'single'
        ? relation('linkTrack', album.tracks[0])
     : album.style === 'in-game vgm'
        ? relation('linkThing', 'localized.vgmAlbum', album)
        : relation('linkThing', 'localized.album', album)),
  }),

  data: (album) => ({
    style: album.style,
    name: album.name,
  }),

  generate: (data, relations, {language}) =>
    (data.style === 'single'
      ? relations.link.slot('content', language.sanitize(data.name))
      : relations.link),
};