How to insert data into multiple tables in one request using sequelize?

Viewed 162

I have three tables, and the relationship is as below. enter image description here

The object that I generate in the frontend and that I pass to the backend:

{
  name: "Model1",
  model_2: [
    {
      name: "Model2",
      model_3: [
        {
          name: "Model3"
        }
      ]
    }
  ]
}

I need to know how to make the relationships and how to pass the object to create in the module_1 controller so that it inserts the values.

How can I do it?

0 Answers
Related