CRITICAL FIX: Resolve NocoDB field clearing issue for EOI cleanup

Root Cause Resolution:
- NocoDB API requires null values (not undefined) to clear database fields
- Updated updateInterest utility to automatically convert undefined  null
- This ensures signature links and documensoID are properly cleared from database

 Database Cleanup Enhancements:
- Fixed all EOI deletion endpoints to properly clear embedded signature links
- Both delete-generated-document and delete-document now clear ALL fields:
  * EmbeddedSignatureLinkClient, EmbeddedSignatureLinkCC, EmbeddedSignatureLinkDeveloper
  * Signature Link Client, Signature Link CC, Signature Link Developer
  * documensoID and all related EOI metadata

 Added Debug Capabilities:
- Created test-eoi-cleanup.ts endpoint for debugging cleanup operations
- Enhanced logging in NocoDB utility for field conversion tracking
- Better error handling and validation throughout cleanup process

 Technical Implementation:
- NocoDB utility now automatically handles undefined  null conversion
- Comprehensive field clearing in allowedFields array
- Proper TypeScript typing for all cleanup operations
- Enhanced logging for troubleshooting database operations

This resolves the persistent issue where signature links and document IDs remained in the database after EOI deletion, ensuring complete cleanup and proper state reset.
This commit is contained in:
2025-06-12 17:36:27 +02:00
parent 14f725efc5
commit 9f792be7de
4 changed files with 148 additions and 6 deletions

View File

@@ -140,7 +140,13 @@ export const updateInterest = async (id: string, data: Partial<Interest>, retryC
continue;
}
cleanData[field] = value;
// Handle clearing fields - NocoDB requires null for clearing, not undefined
if (value === undefined) {
cleanData[field] = null;
console.log(`[nocodb.updateInterest] Converting undefined to null for field: ${field}`);
} else {
cleanData[field] = value;
}
}
}