« get me outta code hell

data: withContainingReverseContributionList - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/things/contribution/withContainingReverseContributionList.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-06-17 21:16:07 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-18 22:56:14 -0300
commit0c871cf8e58fc6bc81ecb9a690411c60050f9f1a (patch)
treec8a8435f9c87aeb64f55ac6c2d65a98d66a17210 /src/data/composite/things/contribution/withContainingReverseContributionList.js
parent8dae3f05d0f54963bc08768970033062f5733ef2 (diff)
data: withContainingReverseContributionList
Diffstat (limited to 'src/data/composite/things/contribution/withContainingReverseContributionList.js')
-rw-r--r--src/data/composite/things/contribution/withContainingReverseContributionList.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/data/composite/things/contribution/withContainingReverseContributionList.js b/src/data/composite/things/contribution/withContainingReverseContributionList.js
new file mode 100644
index 00000000..56704c8b
--- /dev/null
+++ b/src/data/composite/things/contribution/withContainingReverseContributionList.js
@@ -0,0 +1,40 @@
+// Get the artist's contribution list containing this property.
+
+import {input, templateCompositeFrom} from '#composite';
+
+import {raiseOutputWithoutDependency} from '#composite/control-flow';
+import {withPropertyFromObject} from '#composite/data';
+
+import withContributionArtist from './withContributionArtist.js';
+
+export default templateCompositeFrom({
+  annotation: `withContainingReverseContributionList`,
+
+  inputs: {
+    artistProperty: input({
+      defaultDependency: 'artistProperty',
+      acceptsNull: true,
+    }),
+  },
+
+  outputs: ['#containingReverseContributionList'],
+
+  steps: () => [
+    raiseOutputWithoutDependency({
+      dependency: input('artistProperty'),
+      output: input.value({
+        ['#containingReverseContributionList']:
+          null,
+      }),
+    }),
+
+    withContributionArtist(),
+
+    withPropertyFromObject({
+      object: '#artist',
+      property: input('artistProperty'),
+    }).outputs({
+      ['#value']: '#containingReverseContributionList',
+    }),
+  ],
+});