Don't fetch actor assets for scene and movie aggregations.
This commit is contained in:
@@ -271,12 +271,15 @@ export async function fetchActorsById(actorIds, options = {}, reqUser) {
|
|||||||
.where('user_id', reqUser.id)
|
.where('user_id', reqUser.id)
|
||||||
.whereIn('actor_id', actorIds)
|
.whereIn('actor_id', actorIds)
|
||||||
: [],
|
: [],
|
||||||
]);
|
].slice(0, options.shallow ? 1 : -1));
|
||||||
|
|
||||||
if (options.order) {
|
if (options.order) {
|
||||||
return actors.map((actorEntry) => curateActor(actorEntry, {
|
return actors.map((actorEntry) => curateActor(actorEntry, {
|
||||||
stashes: stashes.filter((stash) => stash.actor_id === actorEntry.id),
|
stashes: stashes?.filter((stash) => stash.actor_id === actorEntry.id),
|
||||||
alerts: alerts.filter((alert) => alert.actor_id === actorEntry.id),
|
alerts: alerts?.filter((alert) => alert.actor_id === actorEntry.id),
|
||||||
|
profiles: profiles?.filter((profile) => profile.actor_id === actorEntry.id),
|
||||||
|
photos: photos?.filter((photo) => photo.actor_id === actorEntry.id),
|
||||||
|
socials: socials?.filter((social) => social.actor_id === actorEntry.id),
|
||||||
append: options.append,
|
append: options.append,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -290,11 +293,11 @@ export async function fetchActorsById(actorIds, options = {}, reqUser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return curateActor(actor, {
|
return curateActor(actor, {
|
||||||
stashes: stashes.filter((stash) => stash.actor_id === actor.id),
|
stashes: stashes?.filter((stash) => stash.actor_id === actor.id),
|
||||||
alerts: alerts.filter((alert) => alert.actor_id === actor.id),
|
alerts: alerts?.filter((alert) => alert.actor_id === actor.id),
|
||||||
profiles: profiles.filter((profile) => profile.actor_id === actor.id),
|
profiles: profiles?.filter((profile) => profile.actor_id === actor.id),
|
||||||
photos: photos.filter((photo) => photo.actor_id === actor.id),
|
photos: photos?.filter((photo) => photo.actor_id === actor.id),
|
||||||
socials: socials.filter((social) => social.actor_id === actor.id),
|
socials: socials?.filter((social) => social.actor_id === actor.id),
|
||||||
append: options.append,
|
append: options.append,
|
||||||
});
|
});
|
||||||
}).filter(Boolean);
|
}).filter(Boolean);
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ export async function fetchMovies(filters, rawOptions, reqUser, context) {
|
|||||||
const channelCounts = options.aggregateChannels && countAggregations(result.aggregations?.channelIds);
|
const channelCounts = options.aggregateChannels && countAggregations(result.aggregations?.channelIds);
|
||||||
|
|
||||||
const [aggActors, aggTags, aggChannels] = await Promise.all([
|
const [aggActors, aggTags, aggChannels] = await Promise.all([
|
||||||
options.aggregateActors ? fetchActorsById(result.aggregations.actorIds.map((bucket) => bucket.key), { order: ['slug', 'asc'], append: actorCounts }, reqUser) : [],
|
options.aggregateActors ? fetchActorsById(result.aggregations.actorIds.map((bucket) => bucket.key), { shadllow: true, order: ['slug', 'asc'], append: actorCounts }, reqUser) : [],
|
||||||
options.aggregateTags ? fetchTagsById(result.aggregations.tagIds.map((bucket) => bucket.key), { order: [knex.raw('lower(name)'), 'asc'], append: tagCounts }, reqUser, context) : [],
|
options.aggregateTags ? fetchTagsById(result.aggregations.tagIds.map((bucket) => bucket.key), { order: [knex.raw('lower(name)'), 'asc'], append: tagCounts }, reqUser, context) : [],
|
||||||
options.aggregateChannels ? fetchEntitiesById(result.aggregations.channelIds.map((bucket) => bucket.key), { order: ['slug', 'asc'], append: channelCounts }, reqUser, context) : [],
|
options.aggregateChannels ? fetchEntitiesById(result.aggregations.channelIds.map((bucket) => bucket.key), { order: ['slug', 'asc'], append: channelCounts }, reqUser, context) : [],
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -649,7 +649,7 @@ export async function fetchScenes(filters, rawOptions, reqUser, context) {
|
|||||||
console.time('fetch aggregations');
|
console.time('fetch aggregations');
|
||||||
|
|
||||||
const [aggActors, aggTags, aggChannels] = await Promise.all([
|
const [aggActors, aggTags, aggChannels] = await Promise.all([
|
||||||
options.aggregateActors ? fetchActorsById(result.aggregations.actorIds.map((bucket) => bucket.key), { order: ['slug', 'asc'], append: actorCounts }, reqUser) : [],
|
options.aggregateActors ? fetchActorsById(result.aggregations.actorIds.map((bucket) => bucket.key), { shallow: true, order: ['slug', 'asc'], append: actorCounts }, reqUser) : [],
|
||||||
options.aggregateTags ? fetchTagsById(result.aggregations.tagIds.map((bucket) => bucket.key), { order: [knex.raw('lower(name)'), 'asc'], append: tagCounts }, reqUser, context) : [],
|
options.aggregateTags ? fetchTagsById(result.aggregations.tagIds.map((bucket) => bucket.key), { order: [knex.raw('lower(name)'), 'asc'], append: tagCounts }, reqUser, context) : [],
|
||||||
options.aggregateChannels ? fetchEntitiesById(entityIds.map((bucket) => bucket.key), { order: ['slug', 'asc'], append: channelCounts }, reqUser, context) : [],
|
options.aggregateChannels ? fetchEntitiesById(entityIds.map((bucket) => bucket.key), { order: ['slug', 'asc'], append: channelCounts }, reqUser, context) : [],
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user