« get me outta code hell

data: transparent basic Contribution objects - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/things
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-03-04 13:34:56 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-06-12 17:26:31 -0300
commitdb054be170faa6146759cce20b18f242d89dfdcf (patch)
treef8e8f5ba9785cb7377b13751d04f0ae31a866e79 /src/data/composite/things
parent919fb164536151e04e61fde1f1b1bdb5beb3ef88 (diff)
data: transparent basic Contribution objects
Diffstat (limited to 'src/data/composite/things')
-rw-r--r--src/data/composite/things/contribution/index.js1
-rw-r--r--src/data/composite/things/contribution/withContributionArtist.js31
2 files changed, 32 insertions, 0 deletions
diff --git a/src/data/composite/things/contribution/index.js b/src/data/composite/things/contribution/index.js
new file mode 100644
index 00000000..c0506a2b
--- /dev/null
+++ b/src/data/composite/things/contribution/index.js
@@ -0,0 +1 @@
+export {default as withContributionArtist} from './withContributionArtist.js';
diff --git a/src/data/composite/things/contribution/withContributionArtist.js b/src/data/composite/things/contribution/withContributionArtist.js
new file mode 100644
index 00000000..9e588936
--- /dev/null
+++ b/src/data/composite/things/contribution/withContributionArtist.js
@@ -0,0 +1,31 @@
+import {input, templateCompositeFrom} from '#composite';
+import find from '#find';
+
+import {withPropertyFromObject} from '#composite/data';
+import {withResolvedReference} from '#composite/wiki-data';
+
+export default templateCompositeFrom({
+  annotation: `withOwnContributionArtist`,
+
+  inputs: {
+    ref: input({type: 'string'}),
+  },
+
+  outputs: ['#artist'],
+
+  steps: () => [
+    withPropertyFromObject({
+      object: 'thing',
+      property: input.value('artistData'),
+      internal: input.value(true),
+    }),
+
+    withResolvedReference({
+      ref: input('ref'),
+      data: '#thing.artistData',
+      find: input.value(find.artist),
+    }).outputs({
+      '#resolvedReference': '#artist',
+    }),
+  ],
+});