tasks: add clear completion history button on rewards page
CI / update (push) Has been cancelled

This commit is contained in:
2026-04-02 07:46:00 +02:00
parent 21a1f9b976
commit a588b8ee84
2 changed files with 54 additions and 0 deletions
+11
View File
@@ -30,3 +30,14 @@ export const GET: RequestHandler = async ({ locals }) => {
return json({ userStats, userStickers, recentCompletions });
};
export const DELETE: RequestHandler = async ({ locals }) => {
const auth = await locals.auth();
if (!auth?.user?.nickname) throw error(401, 'Not logged in');
await dbConnect();
const { deletedCount } = await TaskCompletion.deleteMany({ completedBy: auth.user.nickname });
return json({ deletedCount });
};