Add Role Assignment Feature for Customers

- Introduced a new role assignment feature for customers, allowing roles to be assigned as either 'admin' or 'analyst'.
- Updated the Customer entity to include a Role field, enhancing the data model to support role management.
- Created new request and response forms for role assignment, ensuring proper validation and structured responses.
- Implemented the AssignRole method in the customer service layer, handling role assignment logic and error management.
- Added a new AssignRole handler to process role assignment requests via the API, complete with Swagger documentation for clarity.
- Updated routes to include the new role assignment endpoint, improving the administrative capabilities of the system.
- Enhanced logging for role assignment operations to ensure traceability and debugging ease.
This commit is contained in:
n.nakhostin
2025-09-17 10:15:14 +03:30
parent 3af09693f8
commit b429bcd24f
5 changed files with 124 additions and 1 deletions
+1
View File
@@ -80,6 +80,7 @@ func RegisterAdminRoutes(e *echo.Echo, userHandler *user.Handler, companyHandler
customersGP.PUT("/:id", customerHandler.UpdateCustomer)
customersGP.DELETE("/:id", customerHandler.DeleteCustomer)
customersGP.PUT("/:id/status", customerHandler.UpdateStatus)
customersGP.PATCH("/:id/role", customerHandler.AssignRole)
}
// Admin Tenders Routes