fix: query type inference

This commit is contained in:
DecDuck
2025-08-11 15:29:12 +10:00
parent 7c234067a5
commit d0475d3ebd
18 changed files with 274 additions and 250 deletions

View File

@ -11,22 +11,24 @@ const AddEntry = type({
* Add game to collection
* @param id Collection ID
*/
export default defineEventHandler<{ body: typeof AddEntry.infer }>(async (h3) => {
const userId = await aclManager.getUserIdACL(h3, ["collections:add"]);
if (!userId)
throw createError({
statusCode: 403,
});
export default defineEventHandler<{ body: typeof AddEntry.infer }>(
async (h3) => {
const userId = await aclManager.getUserIdACL(h3, ["collections:add"]);
if (!userId)
throw createError({
statusCode: 403,
});
const id = getRouterParam(h3, "id");
if (!id)
throw createError({
statusCode: 400,
statusMessage: "ID required in route params",
});
const id = getRouterParam(h3, "id");
if (!id)
throw createError({
statusCode: 400,
statusMessage: "ID required in route params",
});
const body = await readDropValidatedBody(h3, AddEntry);
const gameId = body.id;
const body = await readDropValidatedBody(h3, AddEntry);
const gameId = body.id;
return await userLibraryManager.collectionAdd(gameId, id, userId);
});
return await userLibraryManager.collectionAdd(gameId, id, userId);
},
);