module.exports = {


    friendlyName: 'Modify',


    description: 'Modify user.',


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

        nom: {
            type: 'string',
            required: true
        },
        pays: {
            type: 'string',
        },

        ville: {
            type: 'string',
        },
        description: {
            type: 'string',
        },

        codeEcole: {
            type: 'string',
            required: true
        },


    },


    exits: {
        notFound: {
            statusCode: 404
        },

    },


    fn: async function (inputs, exits) {

      
        let ecoles = await Ecoles.find({codeEcole: inputs.codeEcole }).then(_.first)
        if (!ecoles) {

            return exits.notFound({ message: "Cette Ecole n\'existe pas, veuillez la créer!" })
        }

        let ecolesUpdate = await Ecoles.update({ codeEcole: inputs.codeEcole }, inputs).fetch()

        // All done.
        return exits.success({
            ...ecolesUpdate,
        });

    }

};
