Convert teams api routes.

This commit is contained in:
Mike Cao 2025-01-24 23:34:02 -08:00
parent 7d5556a637
commit e51f182403
15 changed files with 354 additions and 4 deletions

View file

@ -12,10 +12,14 @@ export function badRequest(message?: any) {
return Response.json({ error: 'Bad request', message }, { status: 400 });
}
export function unauthorized() {
return Response.json({ error: 'Unauthorized' }, { status: 401 });
export function notFound(message?: any) {
return Response.json({ error: 'Not found', message, status: 404 });
}
export function serverError(error: any) {
export function unauthorized(message?: any) {
return Response.json({ error: 'Unauthorized', message }, { status: 401 });
}
export function serverError(error?: any) {
return Response.json({ error: 'Server error', message: serializeError(error), status: 500 });
}

View file

@ -30,6 +30,8 @@ export const unitParam = z.string().refine(value => UNIT_TYPES.includes(value),
message: 'Invalid unit',
});
export const roleParam = z.string().regex(/team-member|team-view-only|team-manager/);
export const filterParams = {
url: z.string().optional(),
referrer: z.string().optional(),