We have multiple layers in the code
model (database and its tables and querries)
|
\/
controller (transforms the db object to the correct model)
|
\/
view (puts the nice model in a valid json response).
Our model has one tag table and most entities (like issues and branches) have their main id in there. This means that a link can be establisht with one endpoint ex. /project/:project-id/link/:object-to-link-id, and that there are no collisions.
The bad thing is that the view layer is now dependent on that property of the model layer. Which breaks the concept of seperated layers. Changing the model could mean changing the view, the api and in result the frontend.
Better would be to indicate the type of link in the body of the request:
POST /project/20/link body: {"repositories": [145, 146], "issues": [302]}
We have multiple layers in the code
model (database and its tables and querries)
|
\/
controller (transforms the db object to the correct model)
|
\/
view (puts the nice model in a valid json response).
Our model has one tag table and most entities (like issues and branches) have their main id in there. This means that a link can be establisht with one endpoint ex.
/project/:project-id/link/:object-to-link-id, and that there are no collisions.The bad thing is that the view layer is now dependent on that property of the model layer. Which breaks the concept of seperated layers. Changing the model could mean changing the view, the api and in result the frontend.
Better would be to indicate the type of link in the body of the request:
POST /project/20/link body: {"repositories": [145, 146], "issues": [302]}