我对 AWS AppSync 和 ApolloClient 有疑问。如何在名为 AppSync 的 Amazon 服务中使用用户之间的关联,即作为节点和边缘的连接。我想做的是当我关注用户时,我想通过一个请求查看所有用户的流程。这是我想成为的要求。我如何为此建立一个结构?
query {
getFeeds(id:"myUserId") {
following {
userFeed {
id
ImageDataUrl
textData
date
}
}
}
}
我创建的架构如下
type Comments {
id: ID!
date: Int!
message: String!
user: User
}
type Feed {
id: ID!
user: User!
date: Int!
textData: String
ImageDataUrl: String
VideoDataUrl: String
likes: Like
comments: [Comments]
}
#Objects
type Like {
id: ID!
number: Int!
likers: [User]
}
}
type Query {
getAllUsers(limit: Int): [User]
}
type User {
id: ID!
name: String!
email: String!
imageUrl: String!
imageThumbUrl: String!
followers: [User]
following: [User]
userFeed: [Feed]
}
schema {
query: Query
}