Skip to content

Refactor

Yutaka Oishi edited this page Oct 2, 2024 · 28 revisions

What was refactored:

We changed the endpoints used in the backend so that data isn't being passed around in path parameters anymore. Instead, a majority of any data being sent to the backend is now passed within the request body as JSON data.

Before, entities were uniquely identified using different fields such as the date_created for workouts. However, we decided to create an ID field for all entities stored in the database (i.e. exercises, routines, workouts, etc.) to make it much easier to fetch a specific entitity. This means that the only data that is passed to the backend as a path parameter is the entitity ID, following RESTful principles.

An example of the change can be seen below:

image

Old endpoints for exercises (above)

image

New endpoints for exercises (above)

How this improves maintainability

This refactor greatly improves maintainability since if we wanted to change the kinds of data being passed to the backend, we no longer have to keep changing the endpoints anymore. Instead, we can keep all endpoints the same and only change the request body. This is a lot easier to do since

Clone this wiki locally