Added movies stash page.

This commit is contained in:
2024-03-24 23:36:25 +01:00
parent c06b6d5568
commit 72af9add7d
11 changed files with 739 additions and 532 deletions

View File

@@ -190,8 +190,6 @@ export async function fetchScenesById(sceneIds, { reqUser, ...context } = {}) {
const sceneStashes = stashes.filter((stash) => stash.scene_id === sceneId);
const sceneActorStashes = sceneActors.map((actor) => actorStashes.find((stash) => stash.actor_id === actor.id)).filter(Boolean);
console.log(sceneActors);
return curateScene(scene, {
channel: sceneChannel,
actors: sceneActors,
@@ -411,6 +409,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
scenes.id as id,
scenes.title as title,
scenes.actor_ids as actor_ids,
scenes.entity_ids as entity_ids,
scenes.tag_ids as tag_ids,
scenes.channel_id as channel_id,
scenes.network_id as network_id,
@@ -441,11 +440,15 @@ async function queryManticoreSql(filters, options, _reqUser) {
});
if (filters.entityId) {
builder.whereRaw('any(entity_ids) = ?', filters.entityId);
/* manticore does not support OR if both left and right table are queried https://github.com/manticoresoftware/manticoresearch/issues/1978#issuecomment-2010470068
builder.where((whereBuilder) => {
whereBuilder
.where('scenes.channel_id', filters.entityId)
.orWhere('scenes.network_id', filters.entityId);
});
*/
}
if (typeof filters.isShowcased === 'boolean') {
@@ -472,7 +475,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
]);
} else if (filters.scope === 'results') {
builder.orderBy([
{ column: 'scenes._score', order: 'desc' },
{ column: '_score', order: 'desc' },
{ column: 'scenes.effective_date', order: 'desc' },
]);
} else if (filters.scope === 'stashed' && filters.stashId) {
@@ -523,7 +526,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
?.data.map((row) => ({ key: row.channel_id || row['scenes.channel_id'], doc_count: row['count(*)'] }))
|| [];
const total = Number(results.at(-1).data.find((entry) => entry.Variable_name === 'total_found').Value);
const total = Number(results.at(-1).data.find((entry) => entry.Variable_name === 'total_found')?.Value) || 0;
return {
scenes: results[0].data,