Open AdrienVH opened 1 year ago
const sql = `
SELECT id, id_bateau, date, geom, ROW_NUMBER () OVER (PARTITION BY id_bateau ORDER BY id ASC) AS ordre
FROM trajets
WHERE id_bateau = :idBateau AND geom IS NOT NULL;
`
const trajets = await sequelize.query(sql, { replacements: { idBateau }, type: QueryTypes.SELECT })
console.log(trajets)
[
{
id: 10,
id_bateau: 0,
date: '2022-12-14',
geom: { crs: [Object], type: 'LineString', coordinates: [Array] },
ordre: '1'
},
{
id: 11,
id_bateau: 0,
date: '2022-12-14',
geom: { crs: [Object], type: 'LineString', coordinates: [Array] },
ordre: '2'
}
]
Devrait retourner un bigint selon la doc : https://www.postgresql.org/docs/current/functions-window.html Mais le JSON retourné par l'API contient une string...