diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-04-15 19:14:43 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-04-15 19:14:43 -0300 |
commit | 7809f00b00b584356f1f0430c83045eb0f38cefd (patch) | |
tree | 5f46243dfd49f428d20b0a0e717b442daadb4f99 | |
parent | 403754d46dcb1d8cf72cf25b49e9b66a5e98140f (diff) |
make Album.coverArtDate more reliably available
Fixes sorting issues.
-rw-r--r-- | src/data/patches.js | 25 | ||||
-rw-r--r-- | src/data/things.js | 12 |
2 files changed, 36 insertions, 1 deletions
diff --git a/src/data/patches.js b/src/data/patches.js new file mode 100644 index 00000000..3b9c8c30 --- /dev/null +++ b/src/data/patches.js @@ -0,0 +1,25 @@ +export class PatchManager { + patches = []; +} + +export class Patch { + static type = class {}; + + static inputDescriptors = {}; + static outputDescriptors = {}; +} + +const patches = {}; + +patches.common = {}; + +Object.assign(patches.common, { +}); + +patches.hsmusic = {}; + +Object.assign(patches.hsmusic, { + Album: class extends Patch {}, + Artist: class extends Patch {}, + Track: class extends Patch {}, +}); diff --git a/src/data/things.js b/src/data/things.js index 35ae5cbf..a4ee2e96 100644 --- a/src/data/things.js +++ b/src/data/things.js @@ -430,10 +430,20 @@ Album.propertyDescriptors = { urls: Thing.common.urls(), date: Thing.common.simpleDate(), - coverArtDate: Thing.common.simpleDate(), trackArtDate: Thing.common.simpleDate(), dateAddedToWiki: Thing.common.simpleDate(), + coverArtDate: { + flags: {update: true, expose: true}, + + update: {validate: isDate}, + + expose: { + dependencies: ['date'], + transform: (coverArtDate, { date }) => coverArtDate ?? date ?? null + } + }, + artistContribsByRef: Thing.common.contribsByRef(), coverArtistContribsByRef: Thing.common.contribsByRef(), trackCoverArtistContribsByRef: Thing.common.contribsByRef(), |