spotters: most-active-in sort with country/region selector, collection tracking (seen marks, progress, filters), refresh scripts score activity and report new NL entries
Deploy production / deploy (push) Has been cancelled
Deploy production / deploy (push) Has been cancelled
This commit is contained in:
1 parent
3f294df337
commit
253cd69424
58 files changed
+2151
-72
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import { error, json } from '@sveltejs/kit';
|
||||
import { isOwner } from '#lib/server/owner.js';
|
||||
import { parseSeenBody, setSeen } from '#lib/server/spotting.js';
|
||||
import type { RequestHandler } from './$types';
|
||||
|
||||
/** Owner-only: mark / unmark an entry as seen (collected), optionally with a date and note. */
|
||||
export const POST: RequestHandler = async (event) => {
|
||||
if (!isOwner(event)) error(404, 'Not Found');
|
||||
const body = parseSeenBody(await event.request.json().catch(() => null));
|
||||
if (!body) error(400, 'Bad request');
|
||||
const ok = await setSeen('cars', body.id, body.seen, body.seenOn, body.note);
|
||||
if (!ok) error(404, 'No such entry');
|
||||
return json({ ok: true, ...body });
|
||||
};
|
||||
Reference in new issue
Block a user