« get me outta code hell

yaml, data: store document specs statically on Thing subclasses - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/flash.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-01-20 16:13:36 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-30 07:59:34 -0400
commit296a4961a951e44ea53509391ad225d1491197f9 (patch)
tree4bdedf0f85b7af8d3039bb46ccfd2f1f600db5ce /src/data/things/flash.js
parentac277f23abe0d8432a94f72913f4421b0eebaa62 (diff)
yaml, data: store document specs statically on Thing subclasses
Diffstat (limited to 'src/data/things/flash.js')
-rw-r--r--src/data/things/flash.js43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/data/things/flash.js b/src/data/things/flash.js
index 85fe343..d7e8bb4 100644
--- a/src/data/things/flash.js
+++ b/src/data/things/flash.js
@@ -28,6 +28,8 @@ import {
 
 import {withFlashAct} from '#composite/things/flash';
 
+import {parseContributors} from '#yaml';
+
 import Thing from './thing.js';
 
 export class Flash extends Thing {
@@ -133,6 +135,30 @@ export class Flash extends Thing {
     urls: S.id,
     color: S.id,
   });
+
+  static [Thing.yamlDocumentSpec] = {
+    fieldTransformations: {
+      'Date': (value) => new Date(value),
+
+      'Contributors': parseContributors,
+    },
+
+    propertyFieldMapping: {
+      name: 'Flash',
+      directory: 'Directory',
+      page: 'Page',
+      color: 'Color',
+      urls: 'URLs',
+
+      date: 'Date',
+      coverArtFileExtension: 'Cover Art File Extension',
+
+      featuredTracks: 'Featured Tracks',
+      contributorContribs: 'Contributors',
+    },
+
+    ignoredFields: ['Review Points'],
+  };
 }
 
 export class FlashAct extends Thing {
@@ -170,5 +196,20 @@ export class FlashAct extends Thing {
     flashData: wikiData({
       class: input.value(Flash),
     }),
-  })
+  });
+
+  static [Thing.yamlDocumentSpec] = {
+    propertyFieldMapping: {
+      name: 'Act',
+      directory: 'Directory',
+
+      color: 'Color',
+      listTerminology: 'List Terminology',
+
+      jump: 'Jump',
+      jumpColor: 'Jump Color',
+    },
+
+    ignoredFields: ['Review Points'],
+  };
 }