mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-20 19:51:09 +10:00
22 lines
608 B
TypeScript
22 lines
608 B
TypeScript
import aclManager from "~/server/internal/acls";
|
|
import screenshotManager from "~/server/internal/screenshots";
|
|
|
|
/**
|
|
* Fetch all screenshots for game
|
|
* @param id Game ID
|
|
*/
|
|
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,
|
|
statusMessage: "Missing game ID",
|
|
});
|
|
|
|
const results = await screenshotManager.getUserAllByGame(userId, gameId);
|
|
return results;
|
|
});
|