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?