add verified mappools

This commit is contained in:
2026-03-06 16:33:19 +01:00
parent 10906560f4
commit 2a73be97b3
5 changed files with 77 additions and 17 deletions

View File

@@ -88,7 +88,8 @@ export const load: PageServerLoad = async ({ params, locals }) => {
return {
pool: { ...pool, slots: slotsWithBeatmaps },
canEdit: isOwner || isAdmin
canEdit: isOwner || isAdmin,
isAdmin
};
};
@@ -188,6 +189,30 @@ export const actions: Actions = {
return { success: true };
},
verify: async ({ params, locals }) => {
requireAuth(locals);
if (locals.user!.role !== 'admin') error(403, 'Admins only');
await db
.update(mappool)
.set({ verifiedAt: new Date() })
.where(eq(mappool.id, params.id));
return { success: true };
},
unverify: async ({ params, locals }) => {
requireAuth(locals);
if (locals.user!.role !== 'admin') error(403, 'Admins only');
await db
.update(mappool)
.set({ verifiedAt: null })
.where(eq(mappool.id, params.id));
return { success: true };
},
deletePool: async ({ params, locals }) => {
const pool = await db.query.mappool.findFirst({
where: eq(mappool.id, params.id)