gdenn
6/4/2017 - 1:48 PM

user.js

import mongoose from 'mongoose'

const UserMongooseSchema = mongoose.Schema({
    firstName: String,
    lastName: String,
    email: String,
    position: String,
    company: String,
    password: String
})

const UserMongoose = mongoose.model('User', UserMongooseSchema)

export default UserMongoose
import winston from 'winston'
import {
    GraphQLObjectType,
    GraphQLNonNull,
    GraphQLID
} from 'graphql'
import User from './userSchema'
import {
    UserMongoose
} from '../../../mongoose/user'

export default {
    userByID: {
        type: User,
        args: {
            id: {
                type: new GraphQLNonNull(GraphQLID)
            }
        },
        resolve: (parent, {
            id
        }, ast) => {
            return UserMongoose.find({
                _id: id
            }).limit(1)
        }
    }
}