Exposing stashes on scenes GraphQL object.

This commit is contained in:
2025-04-01 00:55:41 +02:00
parent acef14b02c
commit f5d8c30ff3
5 changed files with 206 additions and 93 deletions

View File

@@ -46,6 +46,12 @@ import {
unstashMovieGraphql,
} from './stashes.js';
import {
alertsSchema,
fetchAlertsGraphql,
createAlertGraphql,
} from './alerts.js';
import { verifyKey } from '../auth.js';
const schema = buildSchema(`
@@ -64,6 +70,7 @@ const schema = buildSchema(`
${actorsSchema}
${entitiesSchema}
${stashesSchema}
${alertsSchema}
`);
const DateTimeScalar = new GraphQLScalarType({
@@ -125,7 +132,8 @@ export async function graphqlApi(req, res) {
entitiesById: async (query, args, info) => fetchEntitiesByIdGraphql(query, req, info),
stashes: async (query) => fetchUserStashesGraphql(query, req),
stash: async (query) => fetchStashGraphql(query, req),
// mutation
alerts: async (query) => fetchAlertsGraphql(query, req),
// stash mutation
createStash: async (query) => createStashGraphql(query, req),
updateStash: async (query) => updateStashGraphql(query, req),
removeStash: async (query) => removeStashGraphql(query, req),
@@ -135,10 +143,12 @@ export async function graphqlApi(req, res) {
unstashActor: async (query) => unstashActorGraphql(query, req),
stashMovie: async (query) => stashMovieGraphql(query, req),
unstashMovie: async (query) => unstashMovieGraphql(query, req),
// alert mutation
createAlert: async (query) => createAlertGraphql(query, req),
},
});
const statusCode = data.errors?.[0]?.originalError.httpCode || 200;
const statusCode = data.errors?.[0]?.originalError?.httpCode || 200;
res.status(statusCode).send(data);
}