Skip to content

Conversation

Mariettrodrigo
Copy link
Contributor

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:

  • Added new RESTful endpoints for branches (/api/v1/branches) by introducing branchRoutes in server.js, defining the routes in src/routes/branch.js, and connecting them to the main app. [1] [2] [3]
  • Implemented the BranchController with methods for adding, retrieving (all and by ID), updating, and deleting branches, including input validation and error handling.
  • Created BranchService to encapsulate business logic for branch operations, interacting with the database via Sequelize.

Database and Model Layer:

  • Defined the Branch Sequelize model and integrated it into the application's model index for use throughout the app. [1] [2] [3]
  • Added migration to create the branches table and a follow-up migration to remove the contactNumber column, ensuring the schema matches the API requirements. [1] [2]

Testing:

  • Added comprehensive integration tests for all branch endpoints, covering success and error cases for creating, retrieving, updating, and deleting branches.

@naveensanjula975 naveensanjula975 merged commit 6226c09 into dev Oct 19, 2025
3 checks passed
@naveensanjula975 naveensanjula975 deleted the feat/branch-endpoints branch October 19, 2025 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants