diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-01-20 17:23:37 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-01-30 07:59:39 -0400 |
commit | 98c2012c0c6233fe3f70ba215c19f6d39d7e1e34 (patch) | |
tree | a64dfa62e4134785ad5a4b9b03baaed47aa0854c /src/data/things/news-entry.js | |
parent | 4739ac5fae824c6c985fca9ae34f6335f5c9c13e (diff) |
data: tidy things folder & imports, nicer fields yaml spec
Diffstat (limited to 'src/data/things/news-entry.js')
-rw-r--r-- | src/data/things/news-entry.js | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/data/things/news-entry.js b/src/data/things/news-entry.js index 06dad629..5a022449 100644 --- a/src/data/things/news-entry.js +++ b/src/data/things/news-entry.js @@ -1,11 +1,8 @@ -import { - contentString, - directory, - name, - simpleDate, -} from '#composite/wiki-properties'; +import Thing from '#thing'; +import {parseDate} from '#yaml'; -import Thing from './thing.js'; +import {contentString, directory, name, simpleDate} + from '#composite/wiki-properties'; export class NewsEntry extends Thing { static [Thing.referenceType] = 'news-entry'; @@ -34,15 +31,16 @@ export class NewsEntry extends Thing { }); static [Thing.yamlDocumentSpec] = { - fieldTransformations: { - 'Date': (value) => new Date(value), - }, + fields: { + 'Name': {property: 'name'}, + 'Directory': {property: 'directory'}, + + 'Date': { + property: 'date', + transform: parseDate, + }, - propertyFieldMapping: { - name: 'Name', - directory: 'Directory', - date: 'Date', - content: 'Content', + 'Content': {property: 'content'}, }, }; } |