From 77fc589466fc0c04326231638c5ec6026e7948d4 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 11 Jan 2025 20:49:26 -0400 Subject: data: soupy reverse --- src/data/things/album.js | 71 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 65 insertions(+), 6 deletions(-) (limited to 'src/data/things/album.js') diff --git a/src/data/things/album.js b/src/data/things/album.js index e4463d27..151b5087 100644 --- a/src/data/things/album.js +++ b/src/data/things/album.js @@ -44,10 +44,11 @@ import { name, referencedArtworkList, referenceList, - reverseReferencedArtworkList, + reverseReferenceList, simpleDate, simpleString, soupyFind, + soupyReverse, thing, thingList, urls, @@ -262,6 +263,7 @@ export class Album extends Thing { // Update only find: soupyFind(), + reverse: soupyReverse(), // used for referencedArtworkList (mixedFind) albumData: wikiData({ @@ -297,7 +299,9 @@ export class Album extends Thing { value: input.value([]), }), - reverseReferencedArtworkList(), + reverseReferenceList({ + reverse: soupyReverse.input('artworksWhichReference'), + }), ], }); @@ -356,6 +360,55 @@ export class Album extends Thing { }, }; + static [Thing.reverseSpecs] = { + albumsWhoseTracksInclude: { + bindTo: 'albumData', + + referencing: album => [album], + referenced: album => album.tracks, + }, + + albumsWhoseTrackSectionsInclude: { + bindTo: 'albumData', + + referencing: album => [album], + referenced: album => album.trackSections, + }, + + albumsWhoseArtworksFeature: { + bindTo: 'albumData', + + referencing: album => [album], + referenced: album => album.artTags, + }, + + albumsWhoseGroupsInclude: { + bindTo: 'albumData', + + referencing: album => [album], + referenced: album => album.groups, + }, + + albumArtistContributionsBy: + soupyReverse.contributionsBy('albumData', 'artistContribs'), + + albumCoverArtistContributionsBy: + soupyReverse.contributionsBy('albumData', 'coverArtistContribs'), + + albumWallpaperArtistContributionsBy: + soupyReverse.contributionsBy('albumData', 'wallpaperArtistContribs'), + + albumBannerArtistContributionsBy: + soupyReverse.contributionsBy('albumData', 'bannerArtistContribs'), + + albumsWithCommentaryBy: { + bindTo: 'albumData', + + referencing: album => [album], + referenced: album => album.commentatorArtists, + }, + }; + static [Thing.yamlDocumentSpec] = { fields: { 'Album': {property: 'name'}, @@ -624,10 +677,7 @@ export class TrackSection extends Thing { // Update only - // used for withAlbum - albumData: wikiData({ - class: input.value(Album), - }), + reverse: soupyReverse(), // Expose only @@ -712,6 +762,15 @@ export class TrackSection extends Thing { }, }; + static [Thing.reverseSpecs] = { + trackSectionsWhichInclude: { + bindTo: 'trackSectionData', + + referencing: trackSection => [trackSection], + referenced: trackSection => trackSection.tracks, + }, + }; + static [Thing.yamlDocumentSpec] = { fields: { 'Section': {property: 'name'}, -- cgit 1.3.0-6-gf8a5