Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
Múltiples consultas sin procesar condicionales en Sequelize `where`

Estoy tratando de agregar una condición condicional a mi consulta Sequelize para poder filtrar como se muestra a continuación, pero actualmente no funciona, porque sobrescribe $and .

¿Cómo lo hago correctamente?

 const params = { where: { $or: sequelize.literal( `exists (select 1 from "FootballGamePlayers" fp where fp.game_id = "FootballGame".id and fp.player_id = ${req.user_id}) OR exists (select 1 from "FootballGameInvites" gi where gi.game_id = "FootballGame".id and gi.user_id = ${req.user_id}) `) } if (req.query.isActive === 'true') { params.where = { ...params.where, $and: sequelize.literal('end_date > NOW()') } } else if (req.query.isActive === 'false') { params.where = { ...params.where, $and: sequelize.literal('end_date < NOW()') } } await FootballGames.findAndCountAll(params)
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!