fix(quotes): import QuoteItem + return real array from dedup branch
Production deploy failed the TypeScript type-check (next build exited 1)
because commit 2acfd2d changed CreateQuoteFromEmailResult.items from
'number' to 'QuoteItem[]' without updating:
1. The type import — QuoteItem was never added to the import from
@/lib/types (line 6 only brought in Quote, Customer, Company).
2. The dedup branch (line 1060-1076) — still passed itemsCount: number
where the new shape requires QuoteItem[]. Now fetches the real rows
via getFullList and sets items_count = items.length for back-compat.
The build log shows the error was visible right at 'Running TypeScript ...'
but the deployment platform's log scraper cut off the actual stderr,
making it look like an opaque DeploymentException. Reproduced locally
with 'npm run build' to confirm both errors.
Build now passes (no next build / tsc failures). All 1392 tests pass.
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
parent
ba1f916102
commit
d79c433704
1 changed files with 6 additions and 3 deletions
|
|
@ -3,7 +3,7 @@ import {
|
|||
PLACEHOLDER_CUSTOMER_IDS,
|
||||
PLACEHOLDER_CUSTOMER_NAMES,
|
||||
} from "@/lib/placeholder-customers";
|
||||
import type { Quote, Customer, Company } from "@/lib/types";
|
||||
import type { Quote, QuoteItem, Customer, Company } from "@/lib/types";
|
||||
|
||||
/**
|
||||
* Server-side quote pipeline used by the MCP layer (n8n) and internal API routes.
|
||||
|
|
@ -1057,7 +1057,9 @@ export async function createQuoteFromEmail(
|
|||
// ── 1. Idempotency: if we already have a quote for this Message-ID, return it.
|
||||
const existing = await findQuoteByMessageId(pb, effectiveMessageId);
|
||||
if (existing) {
|
||||
const itemsCount = await countQuoteItems(pb, existing.id);
|
||||
const existingItems = await pb
|
||||
.collection(QUOTE_ITEMS_COLLECTION)
|
||||
.getFullList<QuoteItem>({ filter: `quote = "${existing.id}"` });
|
||||
const attsCount = await countQuoteAttachments(pb, existing.id);
|
||||
const customer = existing.customer
|
||||
? ((await pb.collection(CUSTOMERS_COLLECTION).getOne(existing.customer)) as Customer)
|
||||
|
|
@ -1069,7 +1071,8 @@ export async function createQuoteFromEmail(
|
|||
quote: existing,
|
||||
customer: customer as Customer,
|
||||
company: company as Company | null,
|
||||
items: itemsCount,
|
||||
items: existingItems,
|
||||
items_count: existingItems.length,
|
||||
attachments: attsCount,
|
||||
deduped: true,
|
||||
quote_number: existing.quote_number,
|
||||
|
|
|
|||
Loading…
Reference in a new issue