1
Fork 0

Enable graphql filtering

This commit is contained in:
viktorstrate 2019-07-23 18:37:13 +02:00
parent 148756d786
commit 3560c2cae8
3 changed files with 8 additions and 8 deletions

View File

@ -50,10 +50,10 @@ const schema = makeAugmentedSchema({
hasRole: true, hasRole: true,
}, },
mutation: false, mutation: false,
query: false, query: true,
// query: { query: {
// exclude: ['ScannerResult', 'AuthorizeResult', 'Subscription'], exclude: ['ScannerResult', 'AuthorizeResult', 'Subscription', 'PhotoURL'],
// }, },
}, },
resolvers: resolvers.reduce((prev, curr) => _.merge(prev, curr), {}), resolvers: resolvers.reduce((prev, curr) => _.merge(prev, curr), {}),
}) })

View File

@ -3,7 +3,7 @@ enum Role {
User User
} }
type User @isAuthenticated { type User @hasRole(roles: [Admin]) {
id: ID! id: ID!
username: String! username: String!
albums: [Album] @relation(name: "OWNS", direction: "OUT") albums: [Album] @relation(name: "OWNS", direction: "OUT")
@ -12,7 +12,7 @@ type User @isAuthenticated {
admin: Boolean admin: Boolean
} }
type Album { type Album @hasRole(roles: [Admin]) {
id: ID! id: ID!
title: String title: String
photos: [Photo] @relation(name: "CONTAINS", direction: "OUT") photos: [Photo] @relation(name: "CONTAINS", direction: "OUT")
@ -31,7 +31,7 @@ type PhotoURL {
height: Int height: Int
} }
type Photo { type Photo @hasRole(roles: [Admin]) {
id: ID! id: ID!
title: String title: String
# Local filepath for the photo # Local filepath for the photo

View File

@ -6,7 +6,7 @@ import { Query } from 'react-apollo'
const getAlbumsQuery = gql` const getAlbumsQuery = gql`
query getMyAlbums { query getMyAlbums {
myAlbums { myAlbums(filter: { parentAlbum: null }) {
id id
title title
photos { photos {