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,
},
mutation: false,
query: false,
// query: {
// exclude: ['ScannerResult', 'AuthorizeResult', 'Subscription'],
// },
query: true,
query: {
exclude: ['ScannerResult', 'AuthorizeResult', 'Subscription', 'PhotoURL'],
},
},
resolvers: resolvers.reduce((prev, curr) => _.merge(prev, curr), {}),
})

View File

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

View File

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