Slice
Slicing is fun, but not in this case. Slicing is focused on deleting relations between entities. And we are talking about slicing potentially alot of relations.
#
Mutationmutation { sliceUser (_where:{name:{_ilike:"%john%"}}) { # <1> groups (_where:{name:{_eq:"Sharks"}}) # <2> roles }}
Slice mutations are devided into two parts:
- This part focuses source records. Use arguments to pinpoint users that you wanna slice
- Selection part defines which relations will be deleted. Also use arguments to pinpoint what targets you want to slice
Given query above EYWA will slice all users that contain name like john
focusing on relations
to groups where group name is Sharks
and deleting all relations to roles for matched users.
Response will return selection keys as boolean values where true marks that relations have been deleted, and false marks that there was some error present during deletion and relations weren't deleted.
#
Response{ "data": { "sliceUser": { "groups": true, "roles": true } }}