我陷入了graphql的困境。 我遵循此https://www.graph.cool/docs/reference/auth/authorization/overview-iegoo0heez
我有这样的架构:
type Card @model {
id: ID! @isUnique
parent: [Card!]! @relation(name: "Parentcards")
children: [Card!]! @relation(name: "Subcards")
}
我想连接孩子,其中一个卡中有Id1
和卡Id2
我用这个:
mutation connectCard($parentId: ID!, $childrenId: ID!) {
addToSubcards(children1CardId: $parentId, children2CardId: $childrenId) {
children1Card {
title
}
children2Card {
title
}
}
}
但是它将自动连接到两侧:
Id1
是Id2
和Id2
也是Id1
的子代在 graphcool.yml 中,**权限:**我写道:
- operation: Card.read
authenticated: true
- operation: Card.create
authenticated: true
- operation: Card.update
authenticated: true
query: ./permissions/updateOrDeleteCard.graphql
- operation: Card.delete
authenticated: true
query: ./permissions/updateOrDeleteCard.graphql
- operation: Parentcards.connect
authenticated: true
- operation: Parentcards.disconnect
authenticated: true
- operation: Subcards.connect
authenticated: true
- operation: Subcards.disconnect
authenticated: true
在 updateOrDeleteCard.graphql 文件中:
query ($node_id: ID!) {
SomeCardExists(filter: {
id: $node_id
})
}
我尝试了另一种通过列表childIds
卡来更新卡子代的方法。但是,当我更新卡时,收到消息:“此突变权限不足”,
所以,这是我的问题,我尝试了两种不同的方法。 请帮助我。
无论如何,非常感谢您!