feat(F-163): completed feature
This commit is contained in:
@@ -23,6 +23,9 @@ export interface PosRouteDeps {
|
||||
}
|
||||
|
||||
const idParamSchema = z.object({ id: z.string().uuid() });
|
||||
// Zod's strict UUID parser rejects the RFC nil UUID used by the seeded default
|
||||
// store. Store references accept the canonical UUID shape, including nil.
|
||||
const storeIdSchema = z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);
|
||||
|
||||
export async function registerPosRoutes(app: FastifyInstance, deps: PosRouteDeps) {
|
||||
const { pool, authenticate } = deps;
|
||||
@@ -174,7 +177,7 @@ export async function registerPosRoutes(app: FastifyInstance, deps: PosRouteDeps
|
||||
const user = await authenticate(request);
|
||||
requireRole(user, 'admin');
|
||||
const body = parseJson(
|
||||
z.object({ storeId: z.string().uuid(), name: z.string().min(1).max(100) }),
|
||||
z.object({ storeId: storeIdSchema, name: z.string().min(1).max(100) }),
|
||||
request.body ?? {},
|
||||
);
|
||||
// Generate a short binding code (8 hex chars)
|
||||
|
||||
Reference in New Issue
Block a user