Improved showcase view.
This commit is contained in:
parent
2e2d8a15ac
commit
b0692d78ac
|
@ -415,48 +415,33 @@ const releaseFields = `
|
|||
`;
|
||||
|
||||
const releasesFragment = `
|
||||
connection: releasesConnection(
|
||||
connection: releasesShowcasedsConnection(
|
||||
filter: {
|
||||
date: {
|
||||
lessThan: $before,
|
||||
greaterThan: $after,
|
||||
}
|
||||
releasesTagsConnection: {
|
||||
none: {
|
||||
tag: {
|
||||
or: [
|
||||
{ slug: { in: $exclude } }
|
||||
{ name: { in: $exclude } }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
# isShowcased: {
|
||||
# equalTo: true
|
||||
# }
|
||||
or: [
|
||||
{
|
||||
entity: {
|
||||
showcased: {
|
||||
equalTo: true
|
||||
release: {
|
||||
date: {
|
||||
lessThan: $before,
|
||||
greaterThan: $after
|
||||
}
|
||||
releasesTagsConnection: {
|
||||
none: {
|
||||
tag: {
|
||||
or: [
|
||||
{ slug: { in: $exclude } }
|
||||
{ name: { in: $exclude } }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
studio: {
|
||||
showcased: {
|
||||
equalTo: true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
first: $limit,
|
||||
offset: $offset,
|
||||
orderBy: $orderBy,
|
||||
orderBy: $orderBy
|
||||
) {
|
||||
releases: nodes {
|
||||
${releaseFields}
|
||||
release {
|
||||
${releaseFields}
|
||||
}
|
||||
}
|
||||
totalCount
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ function initReleasesActions(store, router) {
|
|||
$offset:Int = 0,
|
||||
$after:Datetime = "1900-01-01 00:00:00",
|
||||
$before:Datetime = "2100-01-01 00:00:00",
|
||||
$orderBy: [ReleasesOrderBy!],
|
||||
$orderBy: [ReleasesShowcasedsOrderBy!],
|
||||
$exclude: [String!]
|
||||
) {
|
||||
${releasesFragment}
|
||||
|
@ -34,12 +34,12 @@ function initReleasesActions(store, router) {
|
|||
offset: Math.max(0, (pageNumber - 1)) * limit,
|
||||
after,
|
||||
before,
|
||||
orderBy,
|
||||
orderBy: `RELEASE_BY_RELEASE_ID__${orderBy}`,
|
||||
exclude: store.state.ui.tagFilter,
|
||||
});
|
||||
|
||||
return {
|
||||
releases: releases.map((release) => curateRelease(release)),
|
||||
releases: releases.map((release) => curateRelease(release.release || release)),
|
||||
totalCount,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
exports.up = async (knex) => Promise.resolve()
|
||||
.then(() => knex.raw(`
|
||||
CREATE FUNCTION releases_is_showcased(release releases) RETURNS BOOLEAN AS $$
|
||||
SELECT COALESCE(entities.showcased, false) OR COALESCE(studios.showcased, false) FROM releases
|
||||
LEFT JOIN entities ON entities.id = releases.entity_id
|
||||
LEFT JOIN entities AS studios ON studios.id = releases.studio_id
|
||||
WHERE releases.id = release.id
|
||||
$$ LANGUAGE SQL STABLE;
|
||||
`)).then(() => knex.schema.alterTable('releases', (table) => {
|
||||
table.index('entity_id');
|
||||
table.index('studio_id');
|
||||
}));
|
||||
const config = require('config');
|
||||
|
||||
exports.down = async (knex) => Promise.resolve()
|
||||
.then(() => knex.schema.alterTable('releases', (table) => {
|
||||
table.dropIndex('entity_id');
|
||||
table.dropIndex('studio_id');
|
||||
})).then(() => knex.raw(`
|
||||
DROP FUNCTION IF EXISTS releases_is_showcased;
|
||||
`));
|
||||
exports.up = async (knex) => knex.raw(`
|
||||
CREATE VIEW releases_showcased AS (
|
||||
SELECT releases.id AS release_id FROM releases
|
||||
LEFT JOIN entities ON entities.id = releases.entity_id
|
||||
LEFT JOIN entities AS studios ON studios.id = releases.studio_id
|
||||
WHERE entities.showcased
|
||||
OR entities.showcased
|
||||
);
|
||||
|
||||
COMMENT ON VIEW releases_showcased IS E'@foreignKey (release_id) references releases (id)';
|
||||
GRANT SELECT ON releases_showcased TO :visitor;
|
||||
`, {
|
||||
visitor: knex.raw(config.database.query.user),
|
||||
});
|
||||
|
||||
exports.down = async (knex) => knex.raw(`
|
||||
DROP VIEW IF EXISTS releases_showcased;
|
||||
`);
|
||||
|
|
|
@ -632,7 +632,7 @@ streamQueue.define('fetchStreamSource', async ({ source, tempFileTarget, hashStr
|
|||
});
|
||||
|
||||
async function fetchSource(source, baseMedia) {
|
||||
const maxAttempts = source.attempts || 3;
|
||||
const maxAttempts = source.attempts || argv.mediaAttempts || 3;
|
||||
|
||||
logger.silly(`Fetching media from ${source.src}`);
|
||||
logger.debug(`Memory usage before media fetch: ${process.memoryUsage.rss() / 1000000} MB (${source.src})`);
|
||||
|
|
Loading…
Reference in New Issue