2.0 KiB
2.0 KiB
Correspondence Module Refactoring Report
Date: 2025-12-11 Objective: Fix data display issues and align Correspondence Module with user requirements (Revision-based List).
🛠 Fixes & Changes
1. Revision-Based List View
- Issue: The Correspondence List was displaying one row per Document, hiding revision history.
- Fix: Refactored
CorrespondenceService.findAllto queryCorrespondenceRevisionas the primary entity. - Outcome: The list now displays every revision (e.g., Doc-001 Rev A, Doc-001 Rev B) as separate rows. Added "Rev" column to the UI.
2. Correspondence Detail Page
- Issue: Detail page was not displaying Subject/Description correctly (showing "-") because it wasn't resolving the
currentRevisioncorrectly or receiving unwrapped data. - Fix:
- Updated
CorrespondenceDetailto explicitly try findingisCurrentrevision or fallback to index 0. - Updated
useCorrespondence(viacorrespondence.service.ts) to correctly unwrap the NestJS Interceptor response{ data: { ... } }.
- Updated
- Outcome: Detail page now correctly shows Subject, Description, and Status from the current revision.
3. Edit Functionality
- Issue: Clicking "Edit" led to a 404/Blank page.
- Fix:
- Created
app/(dashboard)/correspondences/[id]/edit/page.tsx. - Refactored
CorrespondenceFormto acceptinitialDataand supporting "Update" mode (switching betweencreateMutationandupdateMutation).
- Created
- Outcome: Users can now edit existing DRAFT correspondences.
📂 Modified Files
backend/src/modules/correspondence/correspondence.service.tsfrontend/types/correspondence.tsfrontend/components/correspondences/list.tsxfrontend/components/correspondences/detail.tsxfrontend/components/correspondences/form.tsxfrontend/lib/services/correspondence.service.tsfrontend/app/(dashboard)/correspondences/[id]/edit/page.tsx(Created)
✅ Verification
- Validated List View shows revisions.
- Validated Detail View loads data.
- Validated Edit Page loads data and submits updates.