Prisma1: Pre and post hooks on mutations

Created on 3 Apr 2017  路  4Comments  路  Source: prisma/prisma1

I would like to register post and pre hooks before and after some of my mutations, right in the UI. Calling custom pre-hooks is a pain right now, and requires a lot of unnecessary calls as you need to treat Apollo queries and pre-hooked mutations differently. This is a key feature to me. Custom constraints would only solve partially the issue

Most helpful comment

Current use case: user creates an entity of which this user should be set as owner. This owner property could be set automatically instead of the user setting it explicitly in the mutation from the client.

All 4 comments

Current use case: user creates an entity of which this user should be set as owner. This owner property could be set automatically instead of the user setting it explicitly in the mutation from the client.

It's now possible to fully control the request pipeline of a mutation: https://www.graph.cool/docs/reference/functions/request-pipeline/overview-pa6guruhaf/

Here are examples: https://github.com/graphcool-examples/functions
@altschuler's comment is best discussed here: #219.

Hello, I don麓t exactly get how this would work with prisma?
@marktani comment is purely related to graphcool isn麓t it?

We support some hooks in prisma as well: https://www.prisma.io/docs/prisma-cli-and-configuration/prisma-yml-5cy7/#hooks-optional

But you can invoke webhooks in your application server as well if this doesn't fit your use case.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlessandroAnnini picture AlessandroAnnini  路  3Comments

nikolasburk picture nikolasburk  路  3Comments

sedubois picture sedubois  路  3Comments

akoenig picture akoenig  路  3Comments

marktani picture marktani  路  3Comments