- DiscordAccount seeded DiscordStatus without its two nullable fields. - bug-report typed reporter.name as string, but users.name is nullable; and the Discord upload wrapped a Buffer directly in a Blob. - Lucide icons take no `title` prop, so the sync spinner's tooltip moved to a wrapping span. - DesktopView cast its dynamic import to a type that included `| null`. - dock PUT cast the request body straight to string[]; it now rejects anything that is not an array of strings instead of writing it to the database. - buildZodSchema assembles a mutable record, since z.ZodRawShape is readonly in zod v4. - The dev-server proxy forwards Bun's `string | Buffer` frames through a helper that satisfies WebSocket.send without copying. bunx tsgo is now clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
25 lines
834 B
TypeScript
25 lines
834 B
TypeScript
import { createRouter } from '../../create-router';
|
|
import { getDockPaths, setDockPaths } from 'officerdb';
|
|
import * as errors from '@@/custom-errors';
|
|
|
|
export const dockRouter = createRouter();
|
|
|
|
// GET / — return dock paths, or null if none saved (frontend uses defaults)
|
|
dockRouter.get('/', async (ctx) => {
|
|
const userId = ctx.get('user').id;
|
|
const paths = await getDockPaths(userId);
|
|
return ctx.json(paths);
|
|
});
|
|
|
|
// PUT / — full replacement of dock paths array
|
|
dockRouter.put('/', async (ctx) => {
|
|
const userId = ctx.get('user').id;
|
|
const body = ctx.get('body') as unknown;
|
|
if (!Array.isArray(body) || body.some((p) => typeof p !== 'string')) {
|
|
throw errors.BAD_REQUEST('Expected an array of dock paths');
|
|
}
|
|
const paths = body as string[];
|
|
await setDockPaths(userId, paths);
|
|
return ctx.json(paths);
|
|
});
|