[英]How to get ChatRooms where user A and user B apears in ? GraphQl many to many relation
我将 AWS AppSync 和 DynamoDB 与 Amplify 一起使用。 它生成了 listUserChatRooms 查询,我可以通过 userID 获取所有聊天室,通过 chatRoomID 获取所有用户,但是......我必须获取用户 A 和用户 B 出现的所有聊天室。
这是我的 GraphQl 架构
type User @model @auth(rules: [
{allow: owner, operations: [create, read, update, delete]},
{allow: private, operations: [read]}
]) {
id: ID!
name: String!
chatRooms: [ChatRoom] @manyToMany(relationName: "UserChatRoom")
}
type ChatRoom @model @auth(rules: [{allow: private}]) {
id: ID!
name: String
topic: String
Users: [User] @manyToMany(relationName: "UserChatRoom")
Messages: [Message] @hasMany(indexName: "byChatRoom", fields: ["id"])
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.