For each customer sale not yet stored as completed, fetch the full sale (GET /sales/:id) and upsert it as a STORE order keyed on hiboutikSaleId. Lines are replaced on each upsert and linked to the matching product version when it still exists. Quotations are skipped, orders are never deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 lines
547 B
TypeScript
13 lines
547 B
TypeScript
import { Prisma } from '../generated/client';
|
|
|
|
/** Product loaded with its versions (`include: { versions: true }`). */
|
|
export type ProductWithVersions = Prisma.ProductGetPayload<{ include: { versions: true } }>;
|
|
|
|
/**
|
|
* Order to save with its lines. Lines are kept apart from the nested Prisma input so that the repository can link
|
|
* them to the current catalog (`productVersion`) and replace them on update.
|
|
*/
|
|
export type OrderWithLinesInput = Omit<Prisma.OrderCreateInput, 'lines'> & {
|
|
lines: Prisma.OrderLineCreateWithoutOrderInput[];
|
|
};
|