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

210
Visualizações
Node.js sequelize 3 models with 1 pivot

I am trying to create my models and relationships for a Node.js application with a MySQL database. My models are the following:

User, Area, Level

I want the level a user has on a specific area. So the relations should be something like this. So all of them are in a many-to-many relationship with each other.

User.hasMany(Area)

User.hasMany(Level)

Area.hasMany(Level)

Area.hasMany(User)

Level.hasMany(User)

Level.hasMany(Area)

Do want to connect them throught one pivot table i.e. area_employee_levels that will include user_id, area_id, level_id. Is there any way to do this with sequelize? And then how to get select the user with all the relationships?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I think you need to read this part of the documentation for Sequelize. It will help you on you issue

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