#update with null values

28 messages · Page 1 of 1 (latest)

wraith crypt
#

@tawdry star did you attempt to pass a value of any type to those paths? If so, the values would have to represent a uuid. Otherwise it's returning an invalid input making it null. Remember that uuid has a specific bit

#

A code snippet would help too solve this problem as well. Such as what value you try to set it with

tawdry star
#

update works great for instances with not relations

tawdry star
#

basically:

open bramble
tawdry star
#

I guess there's no method equivalent¿?

wraith crypt
# tawdry star

here's the equivalent

await prisma.product.update({
  where: { productId: input.product.productID },
  data: { product: { set: input.product }
})
#

where will do the findOne part and data is what you provide to the model to update

tawdry star
wraith crypt
#

yes of course

tawdry star
#

something like this?

#

my input is the whole object coming from react

wraith crypt
#

you need to set a property within the model not just the whole model

#

actually if your object contains the exact properties as the model, you should just be able to use ...input

tawdry star
#

i see, so i think my issue isn't even prisma, i'm generating zod schemas and i think the issue is the library i'm using

#

did a console log and the info isn't even reaching the endpoint

#

😂

wraith crypt
#

Ooh very nice!

tawdry star
#

okay so after a week...jeez, i came back to this library "zod-prisma-types"

#

i manually added what the "writeNullishInModelTypes" method is supposed to do and worked

#

i have it set to true but doesn't work