fix: Exclude id field from noteData in update route #7
@@ -33,7 +33,7 @@ export async function PUT(req: NextRequest, { params }: { params: Promise<{ id:
|
|||||||
throw new ValidationError(result.error.issues)
|
throw new ValidationError(result.error.issues)
|
||||||
}
|
}
|
||||||
|
|
||||||
const { tags, ...noteData } = result.data
|
const { tags, id: _, ...noteData } = result.data
|
||||||
|
|
||||||
const existingNote = await prisma.note.findUnique({ where: { id } })
|
const existingNote = await prisma.note.findUnique({ where: { id } })
|
||||||
if (!existingNote) {
|
if (!existingNote) {
|
||||||
|
|||||||
Reference in New Issue
Block a user