Added experimental GraphQL API.

This commit is contained in:
2024-06-25 02:35:09 +02:00
parent c4dc953d63
commit c169e5c008
5 changed files with 50 additions and 13 deletions

View File

@@ -41,8 +41,6 @@ export async function curateScenesQuery(query) {
}
export async function fetchScenesApi(req, res) {
console.log('REQUEST', req.query);
const {
scenes,
aggActors,
@@ -58,8 +56,6 @@ export async function fetchScenesApi(req, res) {
limit: Number(req.query.limit) || 30,
}, req.user);
console.log('OUTPUT', scenes.length);
res.send(stringify({
scenes,
aggActors,
@@ -69,3 +65,33 @@ export async function fetchScenesApi(req, res) {
total,
}));
}
export const scenesSchema = `
type Scene {
id: Int!
title: String
}
`;
export async function fetchScenesGraphql(query, req) {
const {
scenes,
aggActors,
aggTags,
aggChannels,
limit,
total,
} = await fetchScenes({}, {
page: 1,
limit: 30,
}, req.user);
return {
scenes,
aggActors,
aggTags,
aggChannels,
limit,
total,
};
}