fix: creating a board without a description returns 500
`description` is optional in the request schema, but the column is
NOT NULL with no default, so an omitted description reached Prisma as
undefined and the create threw a validation error instead of saving:
Invalid `prisma.board.create()` invocation
Argument `description` is missing.
Default it to an empty string, matching what the UI sends today, and
cover it with an API test.
This commit is contained in:
1 parent
af542569bf
commit
8d2938eddb
2 files changed
+38
No files matched your search
@@ -75,6 +75,9 @@ export async function POST(request: Request) {
|
||||
...body,
|
||||
type: normalizeBoardType(body.type),
|
||||
id: uuid(),
|
||||
// The column is NOT NULL with no default, so an omitted description —
|
||||
// which the request schema allows — reaches Prisma as undefined and throws.
|
||||
description: body.description ?? '',
|
||||
parameters: body.parameters ?? {},
|
||||
userId: !teamId ? auth.user.id : undefined,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user