Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

231
Vistas
How to delete multiple id from req.params in sequelize?

how to accept req.params that contain multiple id ? I want to search and delete the multiple id

here's my code :

const id = req.params;
    
    const masterFunders = await masterFunder.findOne({
      where: {
        id: ids
      }
    })

    if (!masterFunders) {
      return res.API.error(RESPONSE_MESSAGE.file_not_found, 400)
    }

    if (masterFunders.createdAt.getTime() > new Date().getTime() - (1000 * 60 * 60 * 24 * 10 * 3)) {
      return res.API.error(RESPONSE_MESSAGE.cannot_delete_file, 400)
    }
    
    await masterFunder.destroy({
      where: { id: ids }
    });

    return res.API.success(RESPONSE_MESSAGE.success, 200)
  } catch (error) {
    console.log(error)
    return res.API.error(error.message)

it's error

{
    "status": false,
    "message": "Invalid value {\n  id: '[de7cc75d-4925-4a8d-869c-9072c7310fc9, b9da8552-e3f9-4628-a5a2-9709399b20dc]'\n}",
    "meta": {}
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

"ids" seems to be a string that contains an array in JSON format, not a JavaScript array.

So you need to do: ids = JSON.parse(ids); to convert the string to a JavaScript array :)

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda