mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-22 04:31:15 +10:00
fix: query type inference
This commit is contained in:
@ -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);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user