feat: separate library and metadata pages, notification acls

This commit is contained in:
DecDuck
2025-05-15 14:55:05 +10:00
parent 086664adfd
commit 1dba112bce
13 changed files with 209 additions and 107 deletions

View File

@ -5,17 +5,19 @@ export default defineEventHandler(async (h3) => {
const userId = await aclManager.getUserIdACL(h3, ["notifications:read"]);
if (!userId) throw createError({ statusCode: 403 });
const userIds = [userId];
const hasSystemPerms = await aclManager.allowSystemACL(h3, [
"notifications:mark",
]);
if (hasSystemPerms) {
userIds.push("system");
}
const acls = await aclManager.fetchAllACLs(h3);
if (!acls)
throw createError({
statusCode: 500,
statusMessage: "Got userId but no ACLs - what?",
});
const notifications = await prisma.notification.findMany({
where: {
userId: { in: userIds },
userId,
acls: {
hasSome: acls,
},
},
orderBy: {
created: "desc", // Newest first