Added stash GraphQL mutations. Added movies to GraphQL queries. Moved key management to profile page, only for approved users.

This commit is contained in:
2025-03-31 06:14:56 +02:00
parent 09bba4fe1e
commit 1025285796
14 changed files with 721 additions and 235 deletions

View File

@@ -8,6 +8,8 @@ import {
reviewActorRevision,
} from '../actors.js';
import { fetchStashByUsernameAndSlug } from '../stashes.js';
export function curateActorsQuery(query) {
return {
query: query.q,
@@ -49,6 +51,7 @@ export const actorsSchema = `
extend type Query {
actors(
query: String
stash: String
limit: Int! = 30
page: Int! = 1
order: [String!]
@@ -115,14 +118,37 @@ function curateGraphqlActor(actor) {
};
}
export async function fetchActorsGraphql(query, _req) {
function getOrder(query) {
if (query.order) {
return query.order;
}
if (query.query) {
return ['results', 'desc'];
}
if (query.stash) {
return ['stashed', 'desc'];
}
return ['likes', 'desc'];
}
export async function fetchActorsGraphql(query, req) {
const stash = query.stash && req.user
? await fetchStashByUsernameAndSlug(req.user.id, query.stash, req.user)
: null;
const {
actors,
total,
} = await fetchActors(query, {
} = await fetchActors({
query: query.query,
stashId: stash?.id,
}, {
limit: query.limit,
page: query.page,
order: query.order,
order: getOrder(query),
aggregateCountries: false,
});