« get me outta code hell

data: Artwork: property cleanup - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-04-02 13:12:53 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-10 16:02:38 -0300
commit5bbecc7e2e9a4836ba3ee8323e685bf70ef51f32 (patch)
tree80d2f2cdc2d4476f9c7c7e002438098ab0cce171 /src/data
parent00b643921f0279fc20d3376e5d0425b64067c2b6 (diff)
data: Artwork: property cleanup
Diffstat (limited to 'src/data')
-rw-r--r--src/data/things/artwork.js65
1 files changed, 35 insertions, 30 deletions
diff --git a/src/data/things/artwork.js b/src/data/things/artwork.js
index f15a2631..fcc766e9 100644
--- a/src/data/things/artwork.js
+++ b/src/data/things/artwork.js
@@ -1,7 +1,7 @@
 import {input} from '#composite';
 import Thing from '#thing';
 import {isContributionList, isDate, validateReferenceList} from '#validators';
-import {parseContributors} from '#yaml';
+import {parseContributors, parseDate} from '#yaml';
 
 import {withPropertyFromObject} from '#composite/data';
 import {simpleString, soupyFind, thing} from '#composite/wiki-properties';
@@ -32,33 +32,14 @@ export class Artwork extends Thing {
 
     thing: thing(),
 
-    artTags: [
-      withResolvedReferenceList({
-        list: input.updateValue({
-          validate:
-            validateReferenceList(ArtTag[Thing.referenceType]),
-        }),
-
-        find: soupyFind.input('artTag'),
-      }),
-
-      exposeDependencyOrContinue({
-        dependency: '#resolvedReferenceList',
-        mode: input.value('empty'),
-      }),
-
-      withPropertyFromObject({
-        object: 'thing',
-        property: input.value('artTags'),
-      }),
+    dateFromThingProperty: simpleString(),
 
-      exposeDependencyOrContinue({
-        dependency: '#thing.artTags',
+    date: [
+      withDate({
+        from: input.updateValue({validate: isDate}),
       }),
 
-      exposeConstant({
-        value: input.value([]),
-      }),
+      exposeDependency({dependency: '#date'}),
     ],
 
     artistContribsFromThingProperty: simpleString(),
@@ -98,14 +79,33 @@ export class Artwork extends Thing {
       }),
     ],
 
-    dateFromThingProperty: simpleString(),
+    artTags: [
+      withResolvedReferenceList({
+        list: input.updateValue({
+          validate:
+            validateReferenceList(ArtTag[Thing.referenceType]),
+        }),
 
-    date: [
-      withDate({
-        from: input.updateValue({validate: isDate}),
+        find: soupyFind.input('artTag'),
       }),
 
-      exposeDependency({dependency: '#date'}),
+      exposeDependencyOrContinue({
+        dependency: '#resolvedReferenceList',
+        mode: input.value('empty'),
+      }),
+
+      withPropertyFromObject({
+        object: 'thing',
+        property: input.value('artTags'),
+      }),
+
+      exposeDependencyOrContinue({
+        dependency: '#thing.artTags',
+      }),
+
+      exposeConstant({
+        value: input.value([]),
+      }),
     ],
 
     // Update only
@@ -115,6 +115,11 @@ export class Artwork extends Thing {
 
   static [Thing.yamlDocumentSpec] = {
     fields: {
+      'Date': {
+        property: 'date',
+        transform: parseDate,
+      },
+
       'Artists': {
         property: 'artistContribs',
         transform: parseContributors,