« get me outta code hell

data: Artwork: inherit art tags from thing - 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-03-31 16:17:34 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-10 16:02:36 -0300
commitceb1d5ba8ed5ab5da7424d9a08ae765bd85b038c (patch)
tree50a242a522452d7eb608f0e31f284ae66e8f4a66 /src/data
parent28ecf1b7ad8a39783a0dd65f84dbffe05f1de44b (diff)
data: Artwork: inherit art tags from thing
Diffstat (limited to 'src/data')
-rw-r--r--src/data/things/artwork.js47
1 files changed, 38 insertions, 9 deletions
diff --git a/src/data/things/artwork.js b/src/data/things/artwork.js
index 86cf6c8a..bfd1ae99 100644
--- a/src/data/things/artwork.js
+++ b/src/data/things/artwork.js
@@ -1,19 +1,24 @@
 import {input} from '#composite';
 import Thing from '#thing';
-import {isContributionList, isDate} from '#validators';
+import {isContributionList, isDate, validateReferenceList} from '#validators';
 import {parseContributors} from '#yaml';
 
-import {withRecontextualizedContributionList, withResolvedContribs}
-  from '#composite/wiki-data';
-import {referenceList, simpleString, soupyFind, thing}
-  from '#composite/wiki-properties';
+import {withPropertyFromObject} from '#composite/data';
+import {simpleString, soupyFind, thing} from '#composite/wiki-properties';
 
 import {
+  exposeConstant,
   exposeDependency,
   exposeDependencyOrContinue,
   exposeUpdateValueOrContinue,
 } from '#composite/control-flow';
 
+import {
+  withRecontextualizedContributionList,
+  withResolvedContribs,
+  withResolvedReferenceList,
+} from '#composite/wiki-data';
+
 import {withDate} from '#composite/things/artwork';
 
 export class Artwork extends Thing {
@@ -27,10 +32,34 @@ export class Artwork extends Thing {
 
     thing: thing(),
 
-    artTags: referenceList({
-      class: input.value(ArtTag),
-      find: soupyFind.input('artTag'),
-    }),
+    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'),
+      }),
+
+      exposeDependencyOrContinue({
+        dependency: '#thing.artTags',
+      }),
+
+      exposeConstant({
+        value: input.value([]),
+      }),
+    ],
 
     artistContribsFromThingProperty: simpleString(),
     artistContribsArtistProperty: simpleString(),