Added basic co-star actor filter to actor page.

This commit is contained in:
DebaucheryLibrarian
2020-09-12 03:09:05 +02:00
parent 24fb267b40
commit 62f5d5111a
7 changed files with 155 additions and 6 deletions

View File

@@ -1004,6 +1004,17 @@ exports.up = knex => Promise.resolve()
GROUP BY entities.id;
$$ LANGUAGE SQL STABLE;
CREATE FUNCTION actors_actors(actor actors) RETURNS SETOF actors AS $$
SELECT actors.*
FROM releases_actors
LEFT JOIN releases_actors AS associated_actors ON associated_actors.release_id = releases_actors.release_id
LEFT JOIN actors ON actors.id = associated_actors.actor_id
WHERE releases_actors.actor_id = actor.id
AND NOT actors.id = actor.id
GROUP BY actors.id
ORDER BY actors.name;
$$ LANGUAGE SQL STABLE;
/* GraphQL/Postgraphile 'every' applies to the data, will only include scenes for which every assigned tag is selected,
instead of what we want; scenes with every selected tag, but possibly also some others */
CREATE FUNCTION actors_scenes(actor actors, selected_tags text[], mode text DEFAULT 'all') RETURNS SETOF releases AS $$
@@ -1108,6 +1119,7 @@ exports.up = knex => Promise.resolve()
COMMENT ON FUNCTION actors_tags IS E'@sortable';
COMMENT ON FUNCTION actors_channels IS E'@sortable';
COMMENT ON FUNCTION actors_actors IS E'@sortable';
COMMENT ON FUNCTION actors_scenes IS E'@sortable';
COMMENT ON FUNCTION tags_scenes IS E'@sortable';
@@ -1179,6 +1191,7 @@ exports.down = (knex) => { // eslint-disable-line arrow-body-style
DROP FUNCTION IF EXISTS releases_is_new;
DROP FUNCTION IF EXISTS actors_tags;
DROP FUNCTION IF EXISTS actors_channels;
DROP FUNCTION IF EXISTS actors_actors;
DROP FUNCTION IF EXISTS actors_scenes;
DROP FUNCTION IF EXISTS movies_actors;