remove slug from board schema
This commit is contained in:
1 parent
a58dadb428
commit
534af98809
4 files changed
+6
-9
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import { z } from 'zod';
|
||||
import { BOARD_TYPES, normalizeBoardType } from '@/lib/boards';
|
||||
import { parseRequest } from '@/lib/request';
|
||||
import { badRequest, json, ok, serverError, unauthorized } from '@/lib/response';
|
||||
import { json, ok, serverError, unauthorized } from '@/lib/response';
|
||||
import { canDeleteBoard, canUpdateBoard, canViewBoard } from '@/permissions';
|
||||
import { deleteBoard, getBoard, updateBoard } from '@/queries/prisma';
|
||||
|
||||
@@ -59,10 +59,6 @@ export async function POST(request: Request, { params }: { params: Promise<{ boa
|
||||
|
||||
return Response.json(board);
|
||||
} catch (e: any) {
|
||||
if (e.message.toLowerCase().includes('unique constraint') && e.message.includes('slug')) {
|
||||
return badRequest({ message: 'That slug is already taken.' });
|
||||
}
|
||||
|
||||
return serverError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ export async function POST(request: Request) {
|
||||
.or(z.literal('open')),
|
||||
name: z.string().max(100),
|
||||
description: z.string().max(500).optional(),
|
||||
slug: z.string().max(100),
|
||||
userId: z.uuid().nullable().optional(),
|
||||
teamId: z.uuid().nullable().optional(),
|
||||
parameters: z
|
||||
@@ -63,7 +62,6 @@ export async function POST(request: Request) {
|
||||
type: normalizeBoardType(body.type),
|
||||
id: uuid(),
|
||||
parameters: body.parameters ?? {},
|
||||
slug: uuid(),
|
||||
userId: !teamId ? auth.user.id : undefined,
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user