Amazon web services 在应用程序同步中筛选查询结果中的子文档
我有两种类型的连接Amazon web services 在应用程序同步中筛选查询结果中的子文档,amazon-web-services,graphql,aws-amplify,aws-appsync,Amazon Web Services,Graphql,Aws Amplify,Aws Appsync,我有两种类型的连接 type Auction @model { id: ID! name: String! startingDate: AWSDateTime! createdAt: AWSDateTime! updatedAt: AWSDateTime! products: [Product] @connection(name: "AuctionProducts") } type Product @model { id: ID! name: String!
type Auction @model {
id: ID!
name: String!
startingDate: AWSDateTime!
createdAt: AWSDateTime!
updatedAt: AWSDateTime!
products: [Product] @connection(name: "AuctionProducts")
}
type Product @model {
id: ID!
name: String!
description: String!
price: Int!
ownerId: String!
createdAt: AWSDateTime!
updatedAt: AWSDateTime!
auction: Auction @connection(name: "AuctionProducts")
}
我想查询一个拍卖和相关的产品,但由ownerId过滤
这个想法是,用户无法在不属于他的拍卖中看到产品
我想做它的安全问题服务器端。我迷失在过滤产品的过程中,就像它们出现在拍卖dynamoDB文档中一样,但事实并非如此
我再也不知道了……这可能吗?现在可能已经知道了,但是你需要一个身份验证服务,Cognoto是最容易使用的。然后,对所有要保护且仅对所有者可见的架构类型使用
@auth
指令:
键入Product@model@auth(规则:[{allow:owner,ownerField:“ownerId”}]){
id:id!
名字:字符串!
描述:字符串!
价格:整数!
所有者ID:字符串!
createdAt:AWSDateTime!
更新日期:AWSDateTime!
拍卖:auction@connection(名称:“AuctionProducts”)
}