« 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/news-entry.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/news-entry.js
parentac277f23abe0d8432a94f72913f4421b0eebaa62 (diff)
yaml, data: store document specs statically on Thing subclasses
Diffstat (limited to 'src/data/things/news-entry.js')
-rw-r--r--src/data/things/news-entry.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/data/things/news-entry.js b/src/data/things/news-entry.js
index f220b270..06dad629 100644
--- a/src/data/things/news-entry.js
+++ b/src/data/things/news-entry.js
@@ -32,4 +32,17 @@ export class NewsEntry extends Thing {
       },
     },
   });
+
+  static [Thing.yamlDocumentSpec] = {
+    fieldTransformations: {
+      'Date': (value) => new Date(value),
+    },
+
+    propertyFieldMapping: {
+      name: 'Name',
+      directory: 'Directory',
+      date: 'Date',
+      content: 'Content',
+    },
+  };
 }