zenstack
zenstack copied to clipboard
Nested update operation throw error when is not the data argument is not provided
Description and expected behavior Nested update operation throw error when is not the data argument is not provided
Screenshots
//THIS WORKS
await prisma.user.update({
where: {id: 1},
data: {
video: {
update: {
data: {
viewCount: {increment: 1}
}
}
}
}
})
//This does not work (but is allowed by types)
await prisma.user.update({
where: {id: 1},
data: {
video: {
update: {
viewCount: {increment: 1}
}
}
}
})
error
Error calling enhanced Prisma method `user.update`:
Invalid `prisma.user.update()` invocation:
{
where: {
id: 1
},
data: {
video: {
update: {
viewCount: {
~~~~~~~~~
increment: 1
},
? duration?: Int | IntFieldUpdateOperationsInput,
? url?: String | StringFieldUpdateOperationsInput,
? delegate_aux_asset?: AssetUpdateOneRequiredWithoutDelegate_aux_videoNestedInput
}
}
},
select: {
id: true
}
}
Unknown argument `viewCount`. Available options are marked with ?.
at main (/Users/cesar/www/zens_bug/src/index.ts:42:23) {
name: 'PrismaClientValidationError',
clientVersion: '6.4.1',
internalStack: 'Error calling enhanced Prisma method `user.update`: \n' +
'Invalid `prisma.user.update()` invocation:\n' +
'\n' +
'{\n' +
' where: {\n' +
' id: 1\n' +
' },\n' +
' data: {\n' +
' video: {\n' +
' update: {\n' +
' viewCount: {\n' +
' ~~~~~~~~~\n' +
' increment: 1\n' +
' },\n' +
'? duration?: Int | IntFieldUpdateOperationsInput,\n' +
'? url?: String | StringFieldUpdateOperationsInput,\n' +
'? delegate_aux_asset?: AssetUpdateOneRequiredWithoutDelegate_aux_videoNestedInput\n' +
' }\n' +
' }\n' +
' },\n' +
' select: {\n' +
' id: true\n' +
' }\n' +
'}\n' +
'\n' +
'Unknown argument `viewCount`. Available options are marked with ?.\n' +
' at PolicyProxyHandler.<anonymous> (/Users/cesar/www/zens_bug/node_modules/@zenstackhq/src/enhancements/node/policy/handler.ts:1199:45),\n' +
' at Generator.next (<anonymous>),\n' +
' at fulfilled (/Users/cesar/www/zens_bug/node_modules/@zenstackhq/src/enhancements/node/policy/handler.ts:1:56)'
}
Process finished with exit code 1
Environment (please complete the following information):
- ZenStack version: 2.12.0
- Prisma version: 6.4.1
- Database type: any
Reproduce Repo https://github.com/cesarve77/zenstack_bug