2024-01-07 05:13:40 +00:00
|
|
|
import { fetchActorsById } from '#/src/actors.js';
|
|
|
|
import { fetchScenes } from '#/src/scenes.js';
|
|
|
|
import { curateScenesQuery } from '#/src/web/scenes.js';
|
|
|
|
|
|
|
|
export async function onBeforeRender(pageContext) {
|
2024-01-08 01:21:57 +00:00
|
|
|
const [[actor], actorScenes] = await Promise.all([
|
|
|
|
fetchActorsById([Number(pageContext.routeParams.actorId)]),
|
|
|
|
fetchScenes(await curateScenesQuery({
|
|
|
|
...pageContext.urlQuery,
|
|
|
|
scope: pageContext.routeParams.scope || 'latest',
|
|
|
|
actorId: Number(pageContext.routeParams.actorId),
|
|
|
|
}), {
|
|
|
|
page: Number(pageContext.routeParams.page) || 1,
|
|
|
|
limit: Number(pageContext.urlParsed.search.limit) || 30,
|
|
|
|
aggregate: true,
|
|
|
|
}),
|
|
|
|
]);
|
2024-01-07 05:13:40 +00:00
|
|
|
|
|
|
|
const {
|
|
|
|
scenes,
|
2024-01-08 01:21:57 +00:00
|
|
|
aggActors,
|
|
|
|
aggTags,
|
2024-01-09 01:26:32 +00:00
|
|
|
aggChannels,
|
2024-01-07 05:13:40 +00:00
|
|
|
total,
|
|
|
|
limit,
|
2024-01-08 01:21:57 +00:00
|
|
|
} = actorScenes;
|
2024-01-07 05:13:40 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
pageContext: {
|
|
|
|
title: actor.name,
|
|
|
|
pageProps: {
|
|
|
|
actor,
|
|
|
|
scenes,
|
2024-01-08 01:21:57 +00:00
|
|
|
aggActors,
|
|
|
|
aggTags,
|
2024-01-09 01:26:32 +00:00
|
|
|
aggChannels,
|
2024-01-07 05:13:40 +00:00
|
|
|
total,
|
|
|
|
limit,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|