Files
drop/server/api/v1/screenshots/game/[id]/index.get.ts
2025-09-20 11:21:53 +10:00

19 lines
577 B
TypeScript

// get all user screenshots by game
import aclManager from "~~/server/internal/acls";
import screenshotManager from "~~/server/internal/screenshots";
export default defineEventHandler(async (h3) => {
const userId = await aclManager.getUserIdACL(h3, ["screenshots:read"]);
if (!userId) throw createError({ statusCode: 403 });
const gameId = getRouterParam(h3, "id");
if (!gameId)
throw createError({
statusCode: 400,
message: "Missing game ID",
});
const results = await screenshotManager.getUserAllByGame(userId, gameId);
return results;
});