
let moment = require('moment');

module.exports = {


    friendlyName: 'Email',


    description: 'Verify Email.',


    inputs: {
        email:{
            type: 'string',
            require: true
        }

    },


    exits: {
        notFound: {
            description: 'User not found',
            statusCode: 404
        },
        encryptionError: {
            statusCode: 500
        }
    },


    fn: async function ({ email}, exits) {

        const { id, user } = this.req.token;
        
        //console.log('USER', user)

        let userUpdate = await Utilisateurs.update({ id: user.id },
            {
              email: email,
            }
          ).fetch()
      
          // All done.
          return exits.success(
            userUpdate
          );

    }
};
