mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-13 00:02:37 +10:00
19 lines
475 B
TypeScript
19 lines
475 B
TypeScript
import aclManager from "~/server/internal/acls";
|
|
import prisma from "~/server/internal/db/database";
|
|
|
|
export default defineEventHandler(async (h3) => {
|
|
const userId = await aclManager.getUserIdACL(h3, ["notifications:read"]);
|
|
if (!userId) throw createError({ statusCode: 403 });
|
|
|
|
const notifications = await prisma.notification.findMany({
|
|
where: {
|
|
userId,
|
|
},
|
|
orderBy: {
|
|
created: "desc", // Newest first
|
|
},
|
|
});
|
|
|
|
return notifications;
|
|
});
|