Added stash GraphQL mutations. Added movies to GraphQL queries. Moved key management to profile page, only for approved users.
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user