« get me outta code hell

linkArtwork.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/linkArtwork.js
blob: 8cd6f359a82dafff1bb3d9db7acc33fce6137c07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
export default {
  contentDependencies: ['linkAlbum', 'linkTrack'],

  query: (artwork) => ({
    referenceType:
      artwork.thing.constructor[Symbol.for('Thing.referenceType')],
  }),

  relations: (relation, query, artwork) => ({
    link:
      (query.referenceType === 'album'
        ? relation('linkAlbum', artwork.thing)
     : query.referenceType === 'track'
        ? relation('linkTrack', artwork.thing)
        : null),
  }),

  generate: (relations) =>
    relations.link,
};