Closed david-loe closed 2 months ago
The changes introduce a new error handling mechanism in the backend code, specifically focusing on deletion operations across various controllers. A ConflictError
class is added to handle scenarios where deletions cannot proceed due to existing references in related models. The deleteOne
method in the Controller
class is updated to incorporate reference checks, and similar updates are made to specific deletion methods in the OrganisationAdminController
, ProjectAdminController
, and UserAdminController
. Additionally, localization files are updated to include conflict alert messages in English and German.
File Path | Change Summary |
---|---|
backend/controller/controller.ts |
Added referenceChecks property to DeleterOptions interface. Updated deleteOne method to throw ConflictError if references exist during deletion. |
backend/controller/error.ts |
Introduced ConflictError class extending ClientError , with status set to 409 and name set to 'alerts.conflict'. |
backend/controller/organisationController.ts |
Modified deleteOrganisation method to include referenceChecks for checking associated projects before deletion. |
backend/controller/projectController.ts |
Updated deleteProject method to include reference checks against ExpenseReport , Travel , and HealthCareCost models before deletion. |
backend/controller/userController.ts |
Enhanced deleteUser method with reference checks for Travel , ExpenseReport , and HealthCareCost models, including conditions for checking historic records. |
backend/mail/mail.ts |
Simplified conditional logic for assigning subject , paragraph , and lastParagraph variables in sendNotificationMail function using logical OR operator. |
backend/models/vueformGenerator.ts |
Changed equality check from == to === in mapSchemaTypeToVueformElement function for strict type comparison. |
backend/pdf/travel.ts |
Simplified logic for processing a string input in PDF generation, using logical OR operator for fallback to an empty string. |
common/locales/de.json |
Added new alert message "conflict": "Konflikt!" to the German localization file. |
common/locales/en.json |
Added new alert message "conflict": "Conflict!" to the English localization file. |
deleteOne
method.🐰 In the garden, changes bloom,
A conflict here, a new error loom.
With checks in place, we clear the way,
No more deletions gone astray!
Hops of joy, let’s celebrate,
A cleaner code, oh, isn’t it great? 🌼
fixes #97
fixes #97
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
ConflictError
to handle deletion conflicts more effectively.Refactor