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