ee6e3f3f3f19a0a43fe414989b43a4b5b6ce9481
handleDocumentCompleted resolves the workflow owner via the Owner-wins chain (document.clientId → companyId → yachtId, then interest.clientId → yachtId), ensures the matching entity subfolder, and sets files.folder_id + the matching entity FK on the signed file row. Falls back to root (folder_id=null) when no owner is resolvable. ensureEntityFolder failures are logged at warn level — the signed PDF always lands; the backfill script heals missing folders. The interest fallback omits the company branch because interests table has no companyId column. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Description
No description provided
Languages
TypeScript
98.7%
HTML
1%
CSS
0.1%
Shell
0.1%