【发布时间】:2017-10-22 13:13:29
【问题描述】:
Graphql 中删除突变的结果应该是什么?我正在使用 graphql-ruby gem。这是我的突变示例,但我不确定我应该返回什么作为响应。
Mutations::Brands::Delete = GraphQL::Relay::Mutation.define do
name "DeleteBrand"
description "Delete a brand"
input_field :id, types.ID
# return_field ??
resolve ->(object, inputs, ctx) {
brand = Brand.find(inputs[:id])
brand.destroy
}
end
【问题讨论】:
-
我认为最佳做法是准确返回您删除的内容,以便 graphql 知道需要删除的内容。
标签: graphql graphql-ruby