Actions
ClientProject #2804
openBackend: Module-Wise Approval Process
Description
The backend infrastructure for the module-wise approval process, enabling CRUD operations for module-to-approver user mappings.
API Endpoints:
- GET /v1/approval-management/module-based-approval: Fetches all module-to-approver mappings.
- POST /v1/approval-management/module-based-approval: Creates new mappings with validation for moduleTitle, approverUserId, and serial.
- PATCH /v1/approval-management/module-based-approval: Updates existing mappings, handling partial updates and deletions.
- DELETE /v1/approval-management/module-based-approval/:moduleTitle: Deletes all mappings for a given moduleTitle.
Controller and Services:
Implemented deleteModuleToApproverUsers in controllers/moduleApproverController.ts, using services from services/deleteModuleToApproverUsers.service.ts.
Added checkModuleRecordsExist and deleteModuleRecords services to validate and delete records in a transaction.
Reused updateModuleToApproverUsers and its services (services/updateModuleToApproverUsers.service.ts) for consistency.
Used Zod for request validation (moduleToApproverUsersValidation.ts) to enforce moduleTitle constraints (non-empty, max 91 characters).
Tested API endpoints with Postman:
- GET: Verified retrieval of mappings.
- POST: Created new mappings and checked for duplicates.
- PATCH: Updated mappings and validated record consistency.
- DELETE: Deleted mappings for a moduleTitle and confirmed 404 for non-existent modules.
Future Improvements:
- Implement audit logging for create, update, and delete operations.
Updated by Najmul Hasan 8 months ago
- Status changed from In Progress to Complete
Actions