const {
    GraphQLInt,
    GraphQLString,
    GraphQLList,
    GraphQLObjectType,
    GraphQLID,
  } = require('graphql');
  
const  db  = require('../../models');

const user = db.users;
const UserType = require('./../types/userType')  

exports.Users = {

    type : GraphQLList(UserType),
    resolve: async () => await user.find({})
  
};       

exports.User = {

  type : UserType,
  args:{
    id:{
      type:GraphQLID
    }
  },
  resolve: async (parent, args) => await user.findById(args.id).exec()

};  
  