Enhance routing and type definitions for new API endpoints. Added support for notifications and SSO routes, updated layout parameters, and improved type safety in route metadata. Refactored component imports for user and profile pages.
CI / build (push) Has been skipped
CI / deploy (push) Successful in 1m27s

This commit is contained in:
eewing
2026-02-23 15:06:11 -06:00
parent 121a6b5844
commit 7de66442aa
196 changed files with 491 additions and 135994 deletions
@@ -0,0 +1,34 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
export const PATCH: RequestHandler = async ({ params, request, locals }) => {
if (!locals.user) {
return json({ error: 'Unauthorized' }, { status: 401 });
}
const id = params.id;
if (!id) {
return json({ error: 'Missing notification id' }, { status: 400 });
}
let body: { isRead?: boolean; isDeleted?: boolean } = {};
try {
body = await request.json();
} catch {
body = {};
}
try {
const record = await locals.pb.collection('notifications').getOne(id);
if ((record as Record<string, unknown>).user !== locals.user.id) {
return json({ error: 'Forbidden' }, { status: 403 });
}
const updates: Record<string, boolean> = {};
if (typeof body.isRead === 'boolean') updates.isRead = body.isRead;
if (typeof body.isDeleted === 'boolean') updates.isDeleted = body.isDeleted;
if (Object.keys(updates).length === 0) {
return json({ error: 'No updates' }, { status: 400 });
}
await locals.pb.collection('notifications').update(id, updates);
return json({ ok: true, ...updates });
} catch {
return json({ error: 'Notification not found or update failed' }, { status: 404 });
}
};