- svelte.config.js: paths.relative=false so CSS uses absolute /_app/ paths (fixes blank home page after redirect)
- ai-jobs: fix openReview() mutating stale alias r instead of $state review — was causing 'Loading results...' to never resolve for chapter-names/image-gen/description
- notifications bell: redesign with All/Unread tabs, per-item dismiss (×), mark-all-read, clear-all, 'View all' footer link
- /admin/notifications: new dedicated full-page notifications view
- api/notifications proxy: add PATCH (mark-all-read) and DELETE (clear-all, dismiss) handlers
- runner: add CreateNotification calls on success/failure in runScrapeTask, runAudioTask, runTranslationTask
- storage/import.go: real PDF (dslipak/pdf) and EPUB (archive/zip + x/net/html) parsing replacing stubs
- translation admin page: stream jobs Promise instead of blocking navigation
- store.go: DeleteNotification, ClearAllNotifications, MarkAllNotificationsRead methods
- handlers_notifications.go + server.go: PATCH /api/notifications, DELETE /api/notifications, DELETE /api/notifications/{id}
30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
import { json, error } from '@sveltejs/kit';
|
|
import type { RequestHandler } from './$types';
|
|
import { backendFetch } from '$lib/server/scraper';
|
|
|
|
export const GET: RequestHandler = async ({ url }) => {
|
|
const userId = url.searchParams.get('user_id');
|
|
if (!userId) throw error(400, 'user_id required');
|
|
const res = await backendFetch('/api/notifications?user_id=' + userId);
|
|
const data = await res.json().catch(() => ({ notifications: [] }));
|
|
return json(data);
|
|
};
|
|
|
|
// PATCH /api/notifications?user_id=<id> — mark all read
|
|
export const PATCH: RequestHandler = async ({ url }) => {
|
|
const userId = url.searchParams.get('user_id');
|
|
if (!userId) throw error(400, 'user_id required');
|
|
const res = await backendFetch('/api/notifications?user_id=' + userId, { method: 'PATCH' });
|
|
const data = await res.json().catch(() => ({}));
|
|
return json(data);
|
|
};
|
|
|
|
// DELETE /api/notifications?user_id=<id> — clear all
|
|
export const DELETE: RequestHandler = async ({ url }) => {
|
|
const userId = url.searchParams.get('user_id');
|
|
if (!userId) throw error(400, 'user_id required');
|
|
const res = await backendFetch('/api/notifications?user_id=' + userId, { method: 'DELETE' });
|
|
const data = await res.json().catch(() => ({}));
|
|
return json(data);
|
|
};
|