Fixed search breaking due missing restrictions, added restrictions to API calls.

This commit is contained in:
2026-02-04 06:37:41 +01:00
parent 6c8fce49d6
commit a1e080c20d
9 changed files with 22 additions and 15 deletions

View File

@@ -33,7 +33,7 @@ export async function fetchMoviesApi(req, res) {
} = await fetchMovies(await curateMoviesQuery(req.query), {
page: Number(req.query.page) || 1,
limit: Number(req.query.limit) || 30,
}, req.user);
}, req.user, { restriction: req.restriction });
res.send(stringify({
movies,
@@ -47,7 +47,7 @@ export async function fetchMoviesApi(req, res) {
}
export async function fetchMovieApi(req, res) {
const [movie] = await fetchMoviesById([Number(req.params.movieId)], { reqUser: req.user });
const [movie] = await fetchMoviesById([Number(req.params.movieId)], { reqUser: req.user }, { restriction: req.restriction });
if (!movie) {
throw new HttpError(`No movie with ID ${req.params.movieId} found`, 404);
@@ -137,7 +137,7 @@ export async function fetchMoviesGraphql(query, req) {
page: query.page || 1,
limit: query.limit || 30,
aggregate: false,
}, req.user);
}, req.user, { restriction: req.restriction });
return {
nodes: movies,

View File

@@ -68,7 +68,9 @@ async function fetchScenesApi(req, res) {
}), {
page: Number(req.query.page) || 1,
limit: Number(req.query.limit) || 30,
}, req.user);
}, req.user, {
restriction: req.restriction,
});
res.send(stringify({
scenes,
@@ -250,7 +252,7 @@ export async function fetchScenesGraphql(query, req) {
}
async function fetchSceneApi(req, res) {
const [scene] = await fetchScenesById([Number(req.params.sceneId)], { reqUser: req.user });
const [scene] = await fetchScenesById([Number(req.params.sceneId)], { reqUser: req.user }, { restriction: req.restriction });
if (!scene) {
throw new HttpError(`No scene with ID ${req.params.sceneId} found`, 404);
@@ -263,6 +265,7 @@ export async function fetchScenesByIdGraphql(query, req) {
const scenes = await fetchScenesById([].concat(query.id, query.ids).filter(Boolean), {
reqUser: req.user,
includePartOf: true,
restriction: req.restriction,
});
if (query.ids) {

View File

@@ -3,6 +3,8 @@ import { fetchTags } from '../tags.js';
export async function fetchTagsApi(req, res) {
const tags = await fetchTags({
query: req.query.query,
}, {
restriction: req.restriction,
});
res.send(tags);