Anyone done this before? No one?
# prisma-whats-new
y
Anyone done this before? No one?
n
@yus this is not possible right now - what's your use case?
y
Hi @nilan im trying to implement my own version of upsert for now. So i start with the client sending a create mutation request. Then in the pre-write hook, I manually query if the record already exists. If yes, I manually perform an update; after which i need to abort the request so the original create request is stopped. I also need to return the correct response to the client.
It seems there must be a better way to achieve this. Any ideas?
I have successfully implemented my own version of upsert. I start with an updateCustomer mutation request from the client. Then a pre-write hook checks if the customer already exists (using fetch). If exists i just pass through, if not i create the customer along with some other custom logic to create a stripe customer and then pass through. Ill post a PR to the example repo soon
n
Nice! I'd love to see that <3