您能发现问题吗? amplify push
没有错误,但在AppSync中创建的查询解析器未显示“ getUser”的身份验证逻辑;仅返回$util.toJson($ctx.result)
的响应。但是,“ getNotice”具有正确格式化的身份验证逻辑。
我正在使用Cognito用户池进行身份验证和“管理员”组。我试图将用户可编辑的数据存储在“用户”中,并且还允许管理员使用完全CRUD。最后,任何授权用户都可以阅读。这是用户架构以及连接的类型。
type User
@model
@auth(rules: [
{allow: groups, groups: ["admin"]},
{allow: owner, operations: [create, read, update, delete]},
{allow: private, operations: [read]},
])
@key(fields: ["userId"])
@key(name: "ByUsernameJoined", fields: ["username", "joined"], queryField: "usersByUsernameJoined")
@key(name: "ByUsername", fields: ["username"], queryField: "usersByUsername")
{
userId: String!
joined: String!
username: String!
fullname: String
about: String
avatar: S3Object
cover: S3Object
preferences: String
notices: [Notice!] @connection(keyName: "ByUserId", fields: ["userId"])
conversations: [UserConversation!] @connection(keyName: "ByUserId", fields: ["userId"])
createdAt: AWSDateTime!
updatedAt: AWSDateTime!
}
type Notice
@model
@auth(rules: [
{allow: groups, groups: ["admin"]},
{allow: owner, ownerField: "userId", operations: [create, read, update, delete]},
])
@key(fields: ["id"])
@key(name: "ByUserId", fields: ["userId"], queryField: "noticesByUserId")
@key(name: "ByUserIdDateSent", fields: ["userId", "dateSent"], queryField: "noticesByUserIdDateSent")
{
id: ID!
user: User @connection(fields: ["userId"])
userId: String!
dateSent: String!
noticeType: String!
status: String
actionLink: String
title: String
content: String
createdAt: AWSDateTime!
updatedAt: AWSDateTime!
}
type UserConversation
@model
@auth(rules: [
{allow: owner, ownerField: "userId", operations: [ create, read, update, delete]},
{allow: groups, groups: ["admin"]},
])
@key(fields: ["id"])
@key(name: "ByUserId", fields: ["userId"], queryField: "UserConvoByUserId")
@key(name: "ByConversationId", fields: ["conversationId"], queryField: "UserConvoByConversationId")
{
id: ID!
userId: String!
conversationId: ID!
conversation: Conversation! @connection(fields: ["conversationId"])
user: User! @connection(fields: ["userId"])
createdAt: AWSDateTime!
updatedAt: AWSDateTime!
}