feat(cleaner): record all material operations in database, including successful deletions

Previously only skipped and failed materials were persisted. Now every
material (deleted, uncertain, skipped, failed) is recorded in
CleanerMaterialDetail for full audit traceability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-04-13 14:24:18 +08:00
parent 0286df94dd
commit 116539ff42
3 changed files with 30 additions and 1 deletions

View File

@@ -758,6 +758,7 @@ export class CleanerService {
materialsSkipped: 0,
errors: [],
skippedMaterials: [],
deletedMaterials: [],
retryCount: 0,
retryAttempts: [],
retriedAt: undefined,
@@ -925,6 +926,12 @@ export class CleanerService {
deleteResult.outcome === DeletionOutcome.Uncertain
) {
detail.materialsDeleted += 1
detail.deletedMaterials.push({
materialCode,
materialName,
rowNumber: rowNumInt,
outcome: deleteResult.outcome
})
if (deleteResult.outcome === DeletionOutcome.Uncertain) {
detail.uncertainDeletions += 1
}
@@ -1106,6 +1113,7 @@ export class CleanerService {
materialsSkipped: 0,
errors: [message],
skippedMaterials: [],
deletedMaterials: [],
retryCount: 0,
retryAttempts: [],
retriedAt: undefined,