1

我正在为一组用户编写 AWS amplify graphql 架构。我希望用户名是公开的(因此任何人都可以通过用户名搜索和查找用户)并且用户的信息(描述等)是私有的(只有关注者可以看到)。

我知道如何使用@auth来设置私人数据,但我怎样才能公开用户名?

4

2 回答 2

0

您可以通过 ApiKey 允许公共模式访问,但使用 @aws_iam 装饰器限制字段

type Post @aws_api_key {
    id: ID!
    author: String
    title: String
    content: String
    url: String
    ups: Int!
    downs: Int!
    version: Int!
    restrictedContent: String!
    @aws_iam
}

https://github.com/aws/aws-appsync-community/issues/1

于 2020-06-16T19:13:50.190 回答
0

看起来这个 PR 将实现这个https://github.com/aws-amplify/amplify-cli/pull/1916

于 2019-09-02T20:06:36.640 回答