module.exports = {


    friendlyName: 'Find',
  
  
    description: 'Find annee.',
  
  
    inputs: {
        search: {
            type: 'string'
        }
  
    },
  
  
    exits: {
  
    },
  
  
    fn: async function (inputs, exits) {
      let systemScos = await AttributionSysSco.find().sort('anneeScolaire DESC')
      .then(systemScos => {
        return Promise.all(systemScos.map(async systemSco => {    

            if(systemSco.codeEcole){
                systemSco.ecole = await Ecoles.find({codeEcole: systemSco.codeEcole}).then(_.first)
            }

          return systemSco;
        }))//.then(users => users.filter(user => user && user.userInfo.agence !== inputs.codAgence)) 
      })

      // All done.
      return exits.success(systemScos);
  
    }
  
  
  };
  