fix(signing): route paper-signed reservation/contract uploads to the right doc type

The Reservation and Contract tabs reused ExternalEoiUploadDialog, but the
service hard-coded the EOI document type, status columns, stage target, and
berth rule. A signed contract uploaded from the Contract tab filed as an
`eoi`, flipped `eoi_status`, and advanced the stage to `eoi` - wrong doc
kind, wrong sub-state, wrong stage.

- external-eoi.service: UPLOAD_CONFIG keyed off docType (eoi | reservation
  | contract) parameterises documentType, file category, storage prefix,
  doc-status column, signed-date column, target stage, advance-from set,
  and berth rule. eoi_status is written only for docType=eoi.
- route: parse docType from the form (default eoi).
- dialog: docType prop; generalised copy; EOI-only UI (active-EOI replace
  banner, public-map flip, cancelActiveDocumentId) gated to docType=eoi.
- reservation/contract tabs: pass docType; drop the coming-soon comments.
- test: docType routing cases (reservation -> reservation_agreement +
  reservation cols; contract -> contract + contract cols; eoi_status stays
  null on both; contract idempotent at/past contract stage).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-01 21:28:04 +02:00
parent a7c11f2c51
commit d98aa5cc8a
6 changed files with 202 additions and 48 deletions

View File

@@ -79,6 +79,13 @@ export const POST = withAuth(
(form.get('cancelActiveDocumentId') as string | null) ?? null;
const cancelActiveDocumentId = cancelActiveDocumentIdRaw?.trim() || undefined;
// Which signed doc this is. Defaults to 'eoi' (legacy callers); the
// reservation/contract tabs post their own type so it files correctly.
const docTypeRaw = (form.get('docType') as string | null)?.trim() ?? 'eoi';
const docType = (
['eoi', 'reservation', 'contract'].includes(docTypeRaw) ? docTypeRaw : 'eoi'
) as 'eoi' | 'reservation' | 'contract';
const result = await uploadExternallySignedEoi({
interestId,
portId: ctx.portId,
@@ -94,6 +101,7 @@ export const POST = withAuth(
signatories,
notes,
cancelActiveDocumentId,
docType,
meta: {
userId: ctx.userId,
portId: ctx.portId,