使用以下放大 graphql 模式我可以实现一些安全性,但不是我想要的:
但是
我怎么知道要创建订单,您必须拥有父餐厅的访问权限?这可能吗?
type Restaurant
@model
@auth(rules: [{allow: owner}, {allow: groups, groupsField: "allowedGroups"}])
{
id: ID!
name: String!
description: String!
city: String!
allowedGroups: [String]
orders: [Order]
@connection(keyName: "byRestaurant", fields: ["id"])
}
type Order
@model(queries: null)
@auth(rules: [{allow: private}]) # Something smarter here ?
@key(name: "byRestaurant", fields: ["restaurantID"])
{
id: ID!
restaurantID: ID!
description: String!
processedAt: AWSDateTime
}