I have events which have a link to a location. I ...
# prisma-whats-new
q
I have events which have a link to a location. I have a mutation callback, that should fire when the event with location is known (there's a one-to-many relation between location and event) To add an event with a location, I have to add the location first, the event without location second and than make the relation between event and location. This all works... However, the mutation callback should not be fired when the event is created, since the location is not known at that time - it still is weird graphcool can't handle it to set the relation at creation time, but that's how it is. So I want the mutation callback to fire when I 'update' the location field of the event, the mutation callback is not fired. Apparently, updating a relation between entities is not(!) considered as an update. (Also checking the permissions, e.g.
edit field
, relations are not considered as fields: when I try to set the permission to update the
location
field of an event, I can't: this
location
-field is not shown as a field). How can I make the callback fire only when an event with location is known?
n
it still is weird graphcool can't handle it to set the relation at creation time, but that's how it is.
You can set the location of the event at creation time by using a nested mutation: https://www.graph.cool/docs/reference/simple-api/nested-mutations-ubohch8quo/
q
Right... got it - it's not possible from the console, is it? I just figured out that this works as expected:
Copy code
curl '<https://api.graph.cool/simple/v1/__PROJECT_ID__>' -H 'content-type: application/json' --data-binary '{"query":"mutation {createFleemanEvent(location: {lat: 51.19, lng: 3.19}) {id}}"}' --compressed
👍 1
which is pretty cool
n
It's not possible from the Databrowser, that's correct. From the playground you can do that
q
Yeah... it may be a good idea to remind people somehow to use the playground. I was fiddling with the tables, which might be discouraged. But well, really cool 😛