forked from DebaucheryLibrarian/traxxx
Improved showcase view.
This commit is contained in:
parent
2e2d8a15ac
commit
b0692d78ac
|
@ -415,48 +415,33 @@ const releaseFields = `
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const releasesFragment = `
|
const releasesFragment = `
|
||||||
connection: releasesConnection(
|
connection: releasesShowcasedsConnection(
|
||||||
filter: {
|
filter: {
|
||||||
date: {
|
release: {
|
||||||
lessThan: $before,
|
date: {
|
||||||
greaterThan: $after,
|
lessThan: $before,
|
||||||
}
|
greaterThan: $after
|
||||||
releasesTagsConnection: {
|
}
|
||||||
none: {
|
releasesTagsConnection: {
|
||||||
tag: {
|
none: {
|
||||||
or: [
|
tag: {
|
||||||
{ slug: { in: $exclude } }
|
or: [
|
||||||
{ name: { in: $exclude } }
|
{ slug: { in: $exclude } }
|
||||||
]
|
{ name: { in: $exclude } }
|
||||||
}
|
]
|
||||||
}
|
|
||||||
}
|
|
||||||
# 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 {
|
||||||
${releaseFields}
|
release {
|
||||||
|
${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 $$
|
|
||||||
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');
|
|
||||||
}));
|
|
||||||
|
|
||||||
exports.down = async (knex) => Promise.resolve()
|
exports.up = async (knex) => knex.raw(`
|
||||||
.then(() => knex.schema.alterTable('releases', (table) => {
|
CREATE VIEW releases_showcased AS (
|
||||||
table.dropIndex('entity_id');
|
SELECT releases.id AS release_id FROM releases
|
||||||
table.dropIndex('studio_id');
|
LEFT JOIN entities ON entities.id = releases.entity_id
|
||||||
})).then(() => knex.raw(`
|
LEFT JOIN entities AS studios ON studios.id = releases.studio_id
|
||||||
DROP FUNCTION IF EXISTS releases_is_showcased;
|
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) {
|
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