diff --git a/server/src/schema/queries/EventsByHost.js b/server/src/schema/queries/EventsByHost.js index 4b2cf35b3..8a6d35848 100644 --- a/server/src/schema/queries/EventsByHost.js +++ b/server/src/schema/queries/EventsByHost.js @@ -1,14 +1,13 @@ import { GraphQLInt, GraphQLList, - GraphQLString, - GraphQLNonNull + GraphQLString } from 'graphql' import { EventType } from '../types' import { Event } from '../../models' const args = { - hostId: { type: new GraphQLNonNull(GraphQLString) }, + hostId: { type: GraphQLString }, minDate: { type: GraphQLInt }, maxDate: { type: GraphQLInt } } @@ -16,7 +15,7 @@ const args = { const resolve = (parent, { hostId, minDate, maxDate }, context) => { return Event.find( Object.assign( - { hostId }, + hostId ? { hostId } : { hostId: context.userId }, minDate || maxDate ? { startDatetime: Object.assign(