

module.exports = {


  friendlyName: 'Find one',


  description: '',


  inputs: {
    /*   id:{
         type:'string',
         required: true
       }*/
  },


  exits: {
    notFound: {
      description: "Not found"
    }
  },


  fn: async function ({ }, exits) {

    let id = this.req.token.id

    let user = await User.findOne(id)
    if (!user) {
      return exits.notFound({ message: "User  not found" })
    }

    //let role = await Role.find({ id: user.role }).then(_.first)


    let section = await Section.find({ id: user.section }).then(_.first)
    if (section) {
      user.section = section
      
    }


    // All done.
    return exits.success(_.merge(_.omit(user, ['password'])/*, _.omit(role,['id',]),_.omit(userInfo,['id'])*/))

  }


}; 
