« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/data/patches.js25
-rw-r--r--src/data/things.js12
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(),