How I can make a initial load data in a hasAndBelongsToMany relation ?
Example:
Model Product
{
idProduct,
Description
(..)
}
Model Order
{
idOrder,
Date
(...)
}
In the swagger have:
PUT: /order/{id}/product/rel/{fk}
{
"id": "string",
"orderId": "string",
"productId": "string"
}
But in I dont know how I can make this my node boot script (how method I can call to make this) ...
I know how to insert orders, insert products but I dont know how I can "link" one or more products in one or more orders.
I see in other links the "Order.Product.link({id1: val1, id2: val2})"
but dont work in node...