
module.exports = {


    friendlyName: 'Delete',


    description: 'Delete admin.',


    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: {
            description: "Not found"
        }
    },


    fn: async function (inputs, exits) {


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

            return exits.notFound({ message: "Cette Ecole n\'existe pas, veuillez la modifier!" })
        }
        //console.log('ID ERROR', ecoles)

        let ecolesDestroy = await Ecoles.destroy({ id: ecoles.id }).fetch();

        // All done.
        return exits.success({ message: 'Done !' })

    }


};
