Event by host adding a fallback to current user if user not specified

This commit is contained in:
Nikola Bjelo committed 2018-10-28 19:00:24 +01:00
1 parent 7476850135
commit 91be2a6ff3
1 file changed
+3 -4
+3 -4
View File
@@ -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(