Added basic actor page with scenes and co-star filtering.
This commit is contained in:
29
src/web/scenes.js
Normal file
29
src/web/scenes.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { stringify } from '@brillout/json-serializer/stringify';
|
||||
|
||||
import { fetchScenes } from '../scenes.js';
|
||||
|
||||
export function curateScenesQuery(query) {
|
||||
return {
|
||||
scope: query.scope || 'latest',
|
||||
actorIds: [query.actorId, ...(query.actors?.split(',') || [])].filter(Boolean).map((actorId) => Number(actorId)),
|
||||
};
|
||||
}
|
||||
|
||||
export async function fetchScenesApi(req, res) {
|
||||
const {
|
||||
scenes,
|
||||
actors,
|
||||
limit,
|
||||
total,
|
||||
} = await fetchScenes(curateScenesQuery(req.query), {
|
||||
page: Number(req.query.page) || 1,
|
||||
limit: Number(req.query.limit) || 30,
|
||||
});
|
||||
|
||||
res.send(stringify({
|
||||
scenes,
|
||||
actors,
|
||||
limit,
|
||||
total,
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user