Expanded GraphQL API with scenes entities and actors.

This commit is contained in:
2024-08-30 02:28:44 +02:00
parent 706ccf1ab3
commit edb10c6d1a
8 changed files with 250 additions and 34 deletions

View File

@@ -69,6 +69,7 @@ export function curateActor(actor, context = {}) {
})),
createdAt: actor.created_at,
updatedAt: actor.updated_at,
scenes: actor.scenes,
likes: actor.stashed,
stashes: context.stashes?.map((stash) => curateStash(stash)) || [],
...context.append?.[actor.id],
@@ -163,16 +164,16 @@ export async function fetchActorsById(actorIds, options = {}, reqUser) {
return curatedActors;
}
function curateOptions(options) {
if (options?.limit > 120) {
function curateOptions(options = {}) {
if (options.limit > 120) {
throw new HttpError('Limit must be <= 120', 400);
}
return {
page: options?.page || 1,
limit: options?.limit || 30,
page: options.page || 1,
limit: options.limit || 30,
aggregateCountries: true,
requireAvatar: options?.requireAvatar || false,
requireAvatar: options.requireAvatar || false,
order: [escape(options.order?.[0]) || 'name', escape(options.order?.[1]) || 'asc'],
};
}