Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- models.profesional.belongsToMany( models.servicio, {as: 'Servicio' ,foreignKey:'ID_pro',through:'cli_pro_ser'});
- models.servicio.belongsToMany(models.profesional,{as:'Profesional',foreignKey:'ID_serv',through:'cli_pro_ser'});
- models.profesional.belongsToMany( models.specialty, {as: 'Especialidad' ,through:'prof_esp'});
- models.specialty.belongsToMany(models.profesional, {as: 'Prof' ,through:'prof_esp'});
- models.profesional.belongsTo(models.clinic,{as: 'Clinica',foreignKey:'ID_cli'} );
- models.clinic.hasMany( models.profesional, {as: 'Profesional' ,foreignKey:'ID_cli'});
- models.Profesional.findAll({
- subQuery: false,
- offset: off,
- limit: 10,
- attributes:['ID','Name','Phone','Photo','Valoracion'],
- include: [{model: cli,as:'Clinica',attributes:['Name','Photo'],required:true,
- include:[{model: address,as:'Direccion', required:true, attributes:['Street','Number','Latitude','Longitude','Province', 'Location']}]},
- {model: specialty, as:'Especialidad', attributes:['Name'], through: {attributes: []}},
- {model: serv, as:'Servicio',duplicating: false, separate:false}],
- where:{Name:{like: '%'+name+'%'},Valoracion:{[Op.gte]:val}},
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement