mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
24 lines
671 B
TypeScript
24 lines
671 B
TypeScript
import { ClientCapabilities } from "~/prisma/client";
|
|
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
|
import prisma from "~/server/internal/db/database";
|
|
|
|
export default defineClientEventHandler(
|
|
async (h3, { fetchClient, fetchUser }) => {
|
|
const client = await fetchClient();
|
|
if (!client.capabilities.includes(ClientCapabilities.CloudSaves))
|
|
throw createError({
|
|
statusCode: 403,
|
|
statusMessage: "Capability not allowed.",
|
|
});
|
|
const user = await fetchUser();
|
|
|
|
const saves = await prisma.saveSlot.findMany({
|
|
where: {
|
|
userId: user.id,
|
|
},
|
|
});
|
|
|
|
return saves;
|
|
},
|
|
);
|