« get me outta code hell

data: Artwork: chop withArtTags, withContentWarningArtTags - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-11-26 19:53:46 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-11-26 20:20:20 -0400
commit3fe4b78ad3fb15296447891fa59baeea05ba6c24 (patch)
tree0250063d4d07be9d932ee0335c098ef9f5939108 /src/data/things
parent5a3d62e696f251647ebf11607b05405aaf384957 (diff)
data: Artwork: chop withArtTags, withContentWarningArtTags
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/artwork.js61
1 files changed, 49 insertions, 12 deletions
diff --git a/src/data/things/artwork.js b/src/data/things/artwork.js
index f30ae29f..d8f7458a 100644
--- a/src/data/things/artwork.js
+++ b/src/data/things/artwork.js
@@ -25,8 +25,6 @@ import {
   parseDimensions,
 } from '#yaml';
 
-import {withPropertyFromList, withPropertyFromObject} from '#composite/data';
-
 import {
   exitWithoutDependency,
   exposeConstant,
@@ -36,9 +34,16 @@ import {
 } from '#composite/control-flow';
 
 import {
+  withFilteredList,
+  withPropertyFromList,
+  withPropertyFromObject,
+} from '#composite/data';
+
+import {
   withRecontextualizedContributionList,
   withResolvedAnnotatedReferenceList,
   withResolvedContribs,
+  withResolvedReferenceList,
 } from '#composite/wiki-data';
 
 import {
@@ -54,12 +59,11 @@ import {
 } from '#composite/wiki-properties';
 
 import {
-  withArtTags,
   withAttachedArtwork,
   withContainingArtworkList,
-  withContentWarningArtTags,
   withContribsFromAttachedArtwork,
   withDate,
+  withPropertyFromAttachedArtwork,
 } from '#composite/things/artwork';
 
 export class Artwork extends Thing {
@@ -218,15 +222,42 @@ export class Artwork extends Thing {
     artTagsFromThingProperty: simpleString(),
 
     artTags: [
-      withArtTags({
-        from: input.updateValue({
+      withResolvedReferenceList({
+        list: input.updateValue({
           validate:
             validateReferenceList(ArtTag[Thing.referenceType]),
         }),
+        find: soupyFind.input('artTag'),
+      }),
+
+      exposeDependencyOrContinue({
+        dependency: '#resolvedReferenceList',
+        mode: input.value('empty'),
+      }),
+
+      withPropertyFromAttachedArtwork({
+        property: input.value('artTags'),
+      }),
+
+      exposeDependencyOrContinue({
+        dependency: '#attachedArtwork.artTags',
+        mode: input.value('empty'),
+      }),
+
+      exitWithoutDependency({
+        dependency: 'artTagsFromThingProperty',
+        value: input.value([]),
+      }),
+
+      withPropertyFromObject({
+        object: 'thing',
+        property: 'artTagsFromThingProperty',
+      }).outputs({
+        ['#value']: '#thing.artTags',
       }),
 
       exposeDependency({
-        dependency: '#artTags',
+        dependency: '#thing.artTags'
       }),
     ],
 
@@ -372,18 +403,24 @@ export class Artwork extends Thing {
     ],
 
     contentWarningArtTags: [
-      withContentWarningArtTags(),
+      withPropertyFromList({
+        list: 'artTags',
+        property: input.value('isContentWarning'),
+      }),
+
+      withFilteredList({
+        list: 'artTags',
+        filter: '#artTags.isContentWarning',
+      }),
 
       exposeDependency({
-        dependency: '#contentWarningArtTags',
+        dependency: '#filteredList',
       }),
     ],
 
     contentWarnings: [
-      withContentWarningArtTags(),
-
       withPropertyFromList({
-        list: '#contentWarningArtTags',
+        list: 'contentWarningArtTags',
         property: input.value('name'),
       }),