Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

208
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!