Feat/branch endpoints #9
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds full CRUD (Create, Read, Update, Delete) support for a new "Branch" resource to the application, including model definition, API routes, controller, service logic, database migrations, and comprehensive tests. The implementation follows the existing project structure and ensures robust validation and error handling.
The most important changes are:
Branch API Implementation:
/api/v1/branches
) by introducingbranchRoutes
inserver.js
, defining the routes insrc/routes/branch.js
, and connecting them to the main app. [1] [2] [3]BranchController
with methods for adding, retrieving (all and by ID), updating, and deleting branches, including input validation and error handling.BranchService
to encapsulate business logic for branch operations, interacting with the database via Sequelize.Database and Model Layer:
Branch
Sequelize model and integrated it into the application's model index for use throughout the app. [1] [2] [3]branches
table and a follow-up migration to remove thecontactNumber
column, ensuring the schema matches the API requirements. [1] [2]Testing: