fix(order,integration-ever-works): two compile errors that break the API and worker production builds on develop

Merged
EV
10d ago
+8-5

Problem

develop does not build for production after today's merges (~65 PRs landed without local builds; every develop Build run was cancelled by the next merge, so CI never showed it). #11042 fixed core; two more compile errors remained, found by running nx run-many -t build -p api,worker -c production --nx-bail=false on develop:

  1. plugin-order:build — order.service.ts:215 TS2345: reservePromotionUsage(cart) requires id: ID, but since #10914 createFromCart takes ICommerceCart & {…}, whose id is optional (base entity model). Semantic conflict between #10897/#10914 and the Q7-W1c promotion-usage change (ee957ea9899).
  2. api:build:production — webpack bundles @gauzy/plugin-integration-ever-works from source under the API's tsconfig (strict: false), where if (placement && 'privateFolder' in placement) return cannot narrow placement: TS2345 at ever-works-docs.service.ts:449 and :452 (DocsPlacement | { privateFolder } passed where DocsPlacement is expected). The plugin's own strict build was green, which is why its PRs (#1103x) passed.

Both API and worker images build these packages, so the stage image build of 17fb739dd would have failed at them.

Fix

  • packages/plugins/order/src/lib/order/order.service.ts — pass the cart with its id narrowed ({ ...cart, id: cart.id as ID }): the cart is persisted at that point. No behaviour change (order.service.spec.ts: 33 pass).
  • packages/plugins/integration-ever-works/src/lib/docs/ever-works-docs.service.ts — check the null / waiting-for-folder case first and the private-folder case on the narrowed value. Same outcome for every placement (ever-works-docs.db.spec.ts, real SQLite: 26 pass). The comment says why the order matters.

Verification

  • nx run plugin-order:build and nx run plugin-integration-ever-works:build — pass.
  • nx run-many -t build -p api,worker -c production --nx-bail=false on develop + these two commits — see the last comment on this PR for the run's result (API and worker bundles, and the copied @gauzy/config of each carrying production: true from #11038).

Per the owner's rule for Gauzy API/UI: develop → stage only.

🤖 Generated with Claude Code


Summary by cubic

Fixes a TypeScript compile error in plugin-order that broke API and worker production builds on develop.

Bug Fixes

  • order.service.ts: passes the cart with its id narrowed ({ ...cart, id: cart.id as ID }) to reservePromotionUsage, since the cart type declares id optional but the reservation requires it.

The fix is behavior-neutral and order.service.spec.ts (33 tests) still passes. The ever-works compile error is no longer in this PR—that fix already landed on develop via #11056, and the merge into this branch took develop's version.