Commit Graph

2 Commits

Author SHA1 Message Date
Matt 4abf74e750 KEYCLOAK AUTH FIX: Phase 3 - Webhook & EOI Endpoints
**UPDATED ENDPOINTS (17/41 total):**
9. eoi-send-to-sales.ts
10. request-more-info-to-sales.ts
11. request-more-information.ts
12. eoi/upload-document.ts
13. eoi/validate-document.ts
14. eoi/check-signature-status.ts

 **AUTHENTICATION:** All support dual auth:
-  x-tag header (webhooks/external calls)
-  Keycloak session (logged-in users)

 **PROGRESS:** 17/41 endpoints completed (41%)
 **NEXT:** Continue with remaining EOI, Email, Files endpoints

 **CRITICAL:** This should RESOLVE the 400 Bad Request errors
when using webhooks after Keycloak authentication!
2025-06-15 16:22:55 +02:00
Matt 41a6f7f1c8 feat: Implement EOI document validation and orphaned data cleanup
- Add new /api/eoi/validate-document endpoint to check document existence
- Automatically clean up orphaned database records when documents don't exist in Documenso
- Update EOISection component to validate documents on mount
- Enhanced delete-generated-document endpoint to handle already-deleted documents
- Updated check-signature-status endpoint with validation logic
- Prevents EOI section from showing when document no longer exists
- Self-healing system that fixes data inconsistencies automatically

Key improvements:
- Validates document existence before showing EOI management UI
- Cleans up documensoID, signature links, and status fields when document is missing
- Graceful handling of 404 errors from Documenso API
- Background validation with user-friendly notifications
- Prevents phantom EOI states that appear generated but don't exist
2025-06-12 17:04:45 +02:00