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

228
Vistas
How do I save an ordered list in TypeORM

I will need to store a bunch of paths in a database, in TypeScript the type of these paths are sorta like:

interface Path {
    waypoints: Waypoint[];
    name: string;
    // ... other stuff
}

interface Waypoint {
    latitude: number;
    longitude: number;
}

In this way, there is a one to many relationship between Path and Waypoint, In addition the waypoints have an order between them for each path.

I'm expecting in the database schema for the Path table to have a unique self incrementing ID as its primary key, and for the Waypoint table to have two columns as its primary key, the foreign key of the path it belongs to, and the index of the waypoint in the list it belongs to.

Something like this:

Path table: | ID | name | |:---|:-----| | 1 | path one| | 2 | path two|

Waypoint table: | Path ID | Index | Lat | Lng | |:--------|:------|:----|:----| | 1 | 1 | 30 | 30 | | 1 | 2 | 40 | 30 | | 2 | 1 | 70 | 50 | | 1 | 3 | 40 | 40 | | 2 | 2 | 60 | 60 |

How could I express this in TypeORM?

about 4 years ago · Juan Pablo Isaza
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