Closed andrei1820 closed 1 year ago
Handle the pivot table as a new object, with 2 belongs-to relations.
Yep that would be the solution. Don't think of it is a pivot, think of it as an intermediary resource. I.e. JSON:API works in resources so you need to represent the pivot table as a resource in your API, with relationships between it and the two related resources on either "side" of the pivot.
How can I handle hasmany pivot table, for example 2 foreign key id with a string description?