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
|
offset: $offset
|
||||||
orderBy: $orderBy
|
orderBy: $orderBy
|
||||||
filter: {
|
filter: {
|
||||||
entity: {
|
entity: {
|
||||||
slug: {
|
or: [
|
||||||
equalTo: $entitySlug
|
{
|
||||||
}
|
slug: { equalTo: $entitySlug }
|
||||||
type: {
|
type: { equalTo: $entityType }
|
||||||
equalTo: $entityType
|
}
|
||||||
}
|
{
|
||||||
}
|
parent:{
|
||||||
|
slug: { equalTo: $entitySlug }
|
||||||
|
type: { equalTo: $entityType }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
parent:{
|
||||||
|
parent: {
|
||||||
|
slug: { equalTo: $entitySlug }
|
||||||
|
type: { equalTo: $entityType }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
effectiveDate: {
|
effectiveDate: {
|
||||||
lessThan: $before,
|
lessThan: $before,
|
||||||
greaterThan: $after
|
greaterThan: $after
|
||||||
|
|
|
@ -1738,23 +1738,23 @@ exports.up = (knex) => Promise.resolve()
|
||||||
WHERE releases.entity_id = entity.id;
|
WHERE releases.entity_id = entity.id;
|
||||||
$$ LANGUAGE SQL STABLE;
|
$$ LANGUAGE SQL STABLE;
|
||||||
|
|
||||||
CREATE FUNCTION entities_scene_tags(entity entities, selectable_tags text[]) RETURNS SETOF tags AS $$
|
CREATE FUNCTION entities_scene_tags(entity entities, selectable_tags text[]) RETURNS SETOF tags AS $$
|
||||||
SELECT tags.*
|
SELECT tags.*
|
||||||
FROM releases
|
FROM releases
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
releases_tags ON releases_tags.release_id = releases.id
|
releases_tags ON releases_tags.release_id = releases.id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
tags ON tags.id = releases_tags.tag_id
|
tags ON tags.id = releases_tags.tag_id
|
||||||
WHERE
|
WHERE
|
||||||
releases.entity_id = entity.id
|
releases.entity_id = entity.id
|
||||||
AND
|
AND
|
||||||
CASE WHEN array_length(selectable_tags, 1) IS NOT NULL
|
CASE WHEN array_length(selectable_tags, 1) IS NOT NULL
|
||||||
THEN tags.slug = ANY(selectable_tags)
|
THEN tags.slug = ANY(selectable_tags)
|
||||||
ELSE true
|
ELSE true
|
||||||
END
|
END
|
||||||
GROUP BY tags.id
|
GROUP BY tags.id
|
||||||
ORDER BY tags.name;
|
ORDER BY tags.name;
|
||||||
$$ LANGUAGE SQL STABLE;
|
$$ LANGUAGE SQL STABLE;
|
||||||
|
|
||||||
/* GraphQL/Postgraphile 'every' applies to the data, will only include scenes for which every assigned tag is selected,
|
/* 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 */
|
instead of what we want; scenes with every selected tag, but possibly also some others */
|
||||||
|
|
Loading…
Reference in New Issue