Selecting parent and grantparent networks in entity releases filter.
This commit is contained in:
parent
4e6b098448
commit
67c1bc6b1c
|
@ -90,14 +90,28 @@ function initEntitiesActions(store, router) {
|
|||
offset: $offset
|
||||
orderBy: $orderBy
|
||||
filter: {
|
||||
entity: {
|
||||
slug: {
|
||||
equalTo: $entitySlug
|
||||
}
|
||||
type: {
|
||||
equalTo: $entityType
|
||||
}
|
||||
}
|
||||
entity: {
|
||||
or: [
|
||||
{
|
||||
slug: { equalTo: $entitySlug }
|
||||
type: { equalTo: $entityType }
|
||||
}
|
||||
{
|
||||
parent:{
|
||||
slug: { equalTo: $entitySlug }
|
||||
type: { equalTo: $entityType }
|
||||
}
|
||||
}
|
||||
{
|
||||
parent:{
|
||||
parent: {
|
||||
slug: { equalTo: $entitySlug }
|
||||
type: { equalTo: $entityType }
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
effectiveDate: {
|
||||
lessThan: $before,
|
||||
greaterThan: $after
|
||||
|
|
|
@ -1738,23 +1738,23 @@ exports.up = (knex) => Promise.resolve()
|
|||
WHERE releases.entity_id = entity.id;
|
||||
$$ LANGUAGE SQL STABLE;
|
||||
|
||||
CREATE FUNCTION entities_scene_tags(entity entities, selectable_tags text[]) RETURNS SETOF tags AS $$
|
||||
SELECT tags.*
|
||||
FROM releases
|
||||
LEFT JOIN
|
||||
releases_tags ON releases_tags.release_id = releases.id
|
||||
LEFT JOIN
|
||||
tags ON tags.id = releases_tags.tag_id
|
||||
WHERE
|
||||
releases.entity_id = entity.id
|
||||
AND
|
||||
CASE WHEN array_length(selectable_tags, 1) IS NOT NULL
|
||||
THEN tags.slug = ANY(selectable_tags)
|
||||
ELSE true
|
||||
END
|
||||
GROUP BY tags.id
|
||||
ORDER BY tags.name;
|
||||
$$ LANGUAGE SQL STABLE;
|
||||
CREATE FUNCTION entities_scene_tags(entity entities, selectable_tags text[]) RETURNS SETOF tags AS $$
|
||||
SELECT tags.*
|
||||
FROM releases
|
||||
LEFT JOIN
|
||||
releases_tags ON releases_tags.release_id = releases.id
|
||||
LEFT JOIN
|
||||
tags ON tags.id = releases_tags.tag_id
|
||||
WHERE
|
||||
releases.entity_id = entity.id
|
||||
AND
|
||||
CASE WHEN array_length(selectable_tags, 1) IS NOT NULL
|
||||
THEN tags.slug = ANY(selectable_tags)
|
||||
ELSE true
|
||||
END
|
||||
GROUP BY tags.id
|
||||
ORDER BY tags.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 */
|
||||
|
|
Loading…
Reference in New Issue