Improved showcase query.

This commit is contained in:
DebaucheryLibrarian 2023-06-17 23:31:09 +02:00
parent 236d4a9427
commit 013675d102
4 changed files with 46 additions and 10 deletions

View File

@ -42,7 +42,7 @@ export default {
}, },
data() { data() {
return { return {
tags: ['anal', 'gay', 'transsexual', 'bisexual', 'pissing', 'anal prolapse'], tags: ['gay', 'transsexual', 'bisexual', 'anal', 'anal prolapse', 'pissing'],
}; };
}, },
computed: { computed: {

View File

@ -425,10 +425,9 @@ const releasesFragment = `
releasesTagsConnection: { releasesTagsConnection: {
none: { none: {
tag: { tag: {
or: [ slug: {
{ slug: { in: $exclude } } in: $exclude
{ name: { in: $exclude } } }
]
} }
} }
} }
@ -444,6 +443,40 @@ const releasesFragment = `
} }
`; `;
// unused due performance
const releasesShowcasedFragment = `
connection: releasesShowcasedsConnection(
filter: {
release: {
date: {
lessThan: $before,
greaterThan: $after
}
releasesTagsConnection: {
none: {
tag: {
or: [
{ slug: { in: $exclude } }
{ name: { in: $exclude } }
]
}
}
}
}
},
first: $limit,
offset: $offset,
orderBy: $orderBy
) {
releases: nodes {
release {
${releaseFields}
}
}
totalCount
}
`;
const mediaFields = ` const mediaFields = `
id id
index index
@ -680,6 +713,7 @@ export {
releasePhotosFragment, releasePhotosFragment,
releaseTrailerFragment, releaseTrailerFragment,
releasesFragment, releasesFragment,
releasesShowcasedFragment,
releaseFragment, releaseFragment,
siteFragment, siteFragment,
sitesFragment, sitesFragment,

View File

@ -3,10 +3,12 @@ const config = require('config');
exports.up = async (knex) => knex.raw(` exports.up = async (knex) => knex.raw(`
CREATE VIEW releases_not_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 AS channels ON channels.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 = false LEFT JOIN entities AS networks ON networks .id = entities.parent_id
OR studios.showcased = false WHERE (studios.showcased = false)
OR (channel.showcased = false AND studios.showcased IS NOT true)
OR (network.showcased = false AND channel.showcased IS NOT true AND studios.showcased IS NOT true)
); );
COMMENT ON VIEW releases_not_showcased IS E'@foreignKey (release_id) references releases (id)'; COMMENT ON VIEW releases_not_showcased IS E'@foreignKey (release_id) references releases (id)';

View File

@ -687,7 +687,7 @@ exports.seed = (knex) => Promise.resolve()
url: network.url, url: network.url,
description: network.description, description: network.description,
has_logo: network.hasLogo, has_logo: network.hasLogo,
showcased: network.showcased, showcased: typeof network.showcased === 'boolean' ? network.showcased : true,
parameters: network.parameters, parameters: network.parameters,
parent_id: grandParentNetworksBySlug[network.parent] || null, parent_id: grandParentNetworksBySlug[network.parent] || null,
})); }));
@ -703,7 +703,7 @@ exports.seed = (knex) => Promise.resolve()
url: network.url, url: network.url,
description: network.description, description: network.description,
has_logo: network.hasLogo, has_logo: network.hasLogo,
showcased: network.showcased, showcased: typeof network.showcased === 'boolean' ? network.showcased : true,
parameters: network.parameters, parameters: network.parameters,
parent_id: parentNetworksBySlug[network.parent] || grandParentNetworksBySlug[network.parent] || null, parent_id: parentNetworksBySlug[network.parent] || grandParentNetworksBySlug[network.parent] || null,
})); }));