WFDASH-WEBAPP/n8n_workfows
Dave cd359b75a9 feat(quotes): split attachments into internal vs outbound with operator upload UI
Splits the quote attachment model along the seam that actually matters:
'operator-only references' (drawings the operator consulted, supplier
emails they filed away) vs 'customer-facing files' (supplier quotes,
drawings, NDAs that need to ride along on the email).

Schema (PB): new `internal_attachments` + `outbound_attachments` fields
on the `quotes` collection, maxSelect 10 each. Existing `attachments`
field kept for back-compat but is no longer the source of truth for
outbound emails.

API:
- GET/POST/DELETE /api/v1/quotes/[id]/internal-attachments[/{filename}]
- GET/POST/DELETE /api/v1/quotes/[id]/outbound-attachments[/{filename}]
- POST /api/v1/quotes/[id]/attachments/upload kept for legacy `attachments`

MCP: `quotes.send_email` description now correctly states
`selectedAttachmentIds` are PB file tokens from `outbound_attachments`
(supplier quotes, drawings, NDAs), not IDs of the legacy `attachments`
collection.

Frontend: `ProcessOutboundAttachmentsCard` component lets the operator
upload/remove customer-facing files during the process page; approval +
process pages now read the new fields.

Outbound Send workflow (deployed as `PIEAkPYYYZLGl6Pj`):
- Old workflow (id `WF_Email_Send_SMTP`) and stale repo file
  (`WFDASH — Quote Outbound Send.json`) replaced.
- New revision intersects `quotes.outbound_attachments` with
  `email_outbound_attachment_ids`, downloads each from
  `/api/files/quotes/<id>/<token>`, and emits
  `options.attachments: [{name, content, type}]` consumed by
  `Send Email (SMTP)` (PO Send pattern).
- Failure path flipped from `send_failed` to `mail_failed` so
  `retryQuoteEmail` can find failed sends (it only accepts the
  latter). Previously failed sends were stranded.

Email Monitor (v5) workflow fixes:
- Reply-branch auth: any authenticated request now passes through;
  pre-fix bug rejected branches that the IMAP trigger hadn't seen yet.
- Reply detection: bulletproof subject regex
  (/Q-?\d{4}-?\d{2}-?\d{3}/) accepts both legacy `Q-2026-09-246`
  and current `Q202609246` formats; canonicalised digits-only for
  PB `~` substring match.

Delivery notes: new pricing endpoint at
/api/v1/delivery-notes/items/[id]/pricing + service-layer methods.

Snapshots kept for forensics: PRE-FIX-REPLY-{BRANCH-AUTH,DETECTION}.json
and push-payload.baseline.json are the previously-deployed workflow
shapes, retained so we can diff/rollback if regression hits.

Verified:
- PUT workflow PIEAkPYYYZLGl6Pj -> 200, active, 25 nodes
- quotes-service.test.ts: 117 pass (4 pre-existing failures unchanged)
- mcp/route.test.ts: 118 pass (2 pre-existing failures unchanged)
- node --check on new Code node JS passes

Docs: docs/quotes-outbound-attachments-deploy.md covers the deploy
procedure; docs/api-mcp-layer.md description sync.
2026-09-09 13:43:56 +02:00
..
SNAPSHOT-WFDASH-v8-from-live-2026-08-21 chore(agent): baseline — uncommitted work from the local directory 2026-08-26 01:00:23 +02:00
1 - WFDASH QUICKBOOKS INVOICE1 - WFDASH QUICKBOOKS INVOICE.json feat(invoicing): add QuickBooks invoicing flow and print functionality 2026-07-09 09:44:55 +02:00
1 - WFDASH QUICKBOOKS INVOICE1 - WFDASH QUICKBOOKS INVOICE_OLD.json feat(invoicing): add QuickBooks invoicing flow and print functionality 2026-07-09 09:44:55 +02:00
1 - WFDASH QUICKBOOKS INVOICE1 - WFDASH QUICKBOOKS INVOICE_OLD_2.json feat(invoicing): add QuickBooks invoicing flow and print functionality 2026-07-09 09:44:55 +02:00
order_items_m74xvviv2hpzz2d.json feat(invoicing): add QuickBooks invoicing flow and print functionality 2026-07-09 09:44:55 +02:00
POCKETBASE NODES.json feat(quotes): add email-to-quote pipeline with attachments and replies 2026-06-16 20:46:28 +02:00
SNAPSHOT-WFDASH-v4-from-live-2026-06-20.json feat: add quote email intake and atomic numbering 2026-06-22 13:58:24 +02:00
SNIPPET-catch-and-create-uploader.js feat: add quote email intake and atomic numbering 2026-06-22 13:58:24 +02:00
SNIPPET-plan-upload-attachments-early-v2.js feat: add quote email intake and atomic numbering 2026-06-22 13:58:24 +02:00
SNIPPET-plan-upload-attachments-early-v3.js feat: add quote email intake and atomic numbering 2026-06-22 13:58:24 +02:00
WFDASH — Price List Match.js feat(sprint): add new sprint pricing workflow and supporting code 2026-07-03 07:29:43 +02:00
WFDASH — Purchase Order Send (Cron).js refactor: switch hardcoded UI colors to semantic theme tokens 2026-07-07 17:22:03 +02:00
WFDASH — Purchase Order Send.js refactor: switch hardcoded UI colors to semantic theme tokens 2026-07-07 17:22:03 +02:00
WFDASH — Purchase Order Send.json refactor: switch hardcoded UI colors to semantic theme tokens 2026-07-07 17:22:03 +02:00
WFDASH — Quote Email Monitor (v3.1 agentic + PDF text).json feat(quotes): add email-to-quote pipeline with attachments and replies 2026-06-16 20:46:28 +02:00
WFDASH — Quote Email Monitor (v4 direct-to-PB).json feat(quotes): add email-to-quote pipeline with attachments and replies 2026-06-16 20:46:28 +02:00
WFDASH — Quote Email Monitor (v5 catch-and-create).json feat(quotes): split attachments into internal vs outbound with operator upload UI 2026-09-09 13:43:56 +02:00
WFDASH — Quote Email Monitor (v5 catch-and-create).PRE-FIX-REPLY-BRANCH-AUTH.json feat(quotes): split attachments into internal vs outbound with operator upload UI 2026-09-09 13:43:56 +02:00
WFDASH — Quote Email Monitor (v5 catch-and-create).PRE-FIX-REPLY-DETECTION.json feat(quotes): split attachments into internal vs outbound with operator upload UI 2026-09-09 13:43:56 +02:00
WFDASH — Quote Item Rewriter.json feat: add locked pricing and overhaul quote rewrite 2026-06-22 23:07:53 +02:00
WFDASH — Quote Outbound Send (push-payload).baseline.json feat(quotes): split attachments into internal vs outbound with operator upload UI 2026-09-09 13:43:56 +02:00
WFDASH — Quote Outbound Send (with-outbound-attachments).json feat(quotes): split attachments into internal vs outbound with operator upload UI 2026-09-09 13:43:56 +02:00