'AWS graphql modeling
I have following schema
type Community
@model
@auth(rules: [{ allow: owner }, { allow: groups, groups: ["AdminRoot"] }]) {
id: ID!
name: String
users: [User] @manyToMany(relationName: "UserCommunity")
owner: ID!
rootAdmin: User @hasOne(fields: ["owner"])
}
type User
@model
@auth(
rules: [
{ allow: owner, ownerField: "id", operations: [read, update] }
{ allow: groups, groups: ["AdminRoot"] }
{ allow: public, provider: apiKey, operations: [create] }
]
) {
id: ID!
name: String
identityId: String
communities: [Community] @manyToMany(relationName: "UserCommunity")
}
My problem is when i when i do this query
query ListCommunities(
$filter: ModelCommunityFilterInput
$limit: Int
$nextToken: String
) {
listCommunities(
filter: $filter
limit: $limit
nextToken: $nextToken
) {
items {
id
name
}
}
}
It displays me all the communities where i am the owner.
But i want to display me all the coummunities also the one where i am not the owner but just a User under users
How do i do this? Do i need a lambda? Or with appsync VTL ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
