Inverted showcased view.

This commit is contained in:
DebaucheryLibrarian 2023-01-16 21:32:22 +01:00
parent 542fbee85e
commit b3a77a7f7e
2 changed files with 7 additions and 7 deletions

View File

@ -417,7 +417,7 @@ const releaseFields = `
const releasesFragment = ` const releasesFragment = `
connection: releasesConnection( connection: releasesConnection(
filter: { filter: {
releasesShowcasedsConnectionExist: true releasesNotShowcasedsConnectionExist: false
date: { date: {
lessThan: $before, lessThan: $before,
greaterThan: $after greaterThan: $after

View File

@ -1,20 +1,20 @@
const config = require('config'); const config = require('config');
exports.up = async (knex) => knex.raw(` exports.up = async (knex) => knex.raw(`
CREATE VIEW releases_showcased AS ( CREATE VIEW releases_not_showcased AS (
SELECT releases.id AS release_id FROM releases SELECT releases.id AS release_id FROM releases
LEFT JOIN entities ON entities.id = releases.entity_id LEFT JOIN entities ON entities.id = releases.entity_id
LEFT JOIN entities AS studios ON studios.id = releases.studio_id LEFT JOIN entities AS studios ON studios.id = releases.studio_id
WHERE entities.showcased WHERE entities.showcased = false
OR entities.showcased OR studios.showcased = false
); );
COMMENT ON VIEW releases_showcased IS E'@foreignKey (release_id) references releases (id)'; COMMENT ON VIEW releases_not_showcased IS E'@foreignKey (release_id) references releases (id)';
GRANT SELECT ON releases_showcased TO :visitor; GRANT SELECT ON releases_not_showcased TO :visitor;
`, { `, {
visitor: knex.raw(config.database.query.user), visitor: knex.raw(config.database.query.user),
}); });
exports.down = async (knex) => knex.raw(` exports.down = async (knex) => knex.raw(`
DROP VIEW IF EXISTS releases_showcased; DROP VIEW IF EXISTS releases_not_showcased;
`); `);