Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

227
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda