From 7809f00b00b584356f1f0430c83045eb0f38cefd Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 15 Apr 2022 19:14:43 -0300 Subject: make Album.coverArtDate more reliably available Fixes sorting issues. --- src/data/patches.js | 25 +++++++++++++++++++++++++ src/data/things.js | 12 +++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/data/patches.js 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(), -- cgit 1.3.0-6-gf8a5