feat(F-140): completed feature

This commit is contained in:
chattie
2026-08-22 13:16:27 +02:00
parent 5748c00623
commit 926add3c97
15 changed files with 340 additions and 23 deletions

View File

@@ -497,11 +497,14 @@ function serializeOrder(order: {
totalCents: number;
trackingNumber?: string | null;
courier?: string | null;
customerName?: string | null;
customerPhone?: string | null;
createdAt: Date;
updatedAt: Date;
idempotencyKey: string | null;
userId?: string;
email?: string | null;
phone?: string | null;
items: Array<{
id: string;
productId: string;
@@ -515,11 +518,17 @@ function serializeOrder(order: {
quantity: number;
createdAt: Date;
}>;
shippingAddress?: { recipientName: string; street: string; city: string; postalCode: string; country: string } | null;
billingAddress?: { recipientName: string; street: string; city: string; postalCode: string; country: string } | null;
payment?: { provider: string; status: string; amountCents: number; last4: string | null; createdAt: Date } | null;
}) {
return {
id: order.id,
userId: order.userId,
email: order.email ?? null,
phone: order.phone ?? null,
customerName: order.customerName ?? null,
customerPhone: order.customerPhone ?? null,
state: order.state,
currency: order.currency,
subtotalCents: order.subtotalCents,
@@ -542,6 +551,9 @@ function serializeOrder(order: {
quantity: item.quantity,
createdAt: item.createdAt.toISOString(),
})),
shippingAddress: order.shippingAddress ?? null,
billingAddress: order.billingAddress ?? null,
payment: order.payment ? { ...order.payment, createdAt: order.payment.createdAt.toISOString() } : null,
createdAt: order.createdAt.toISOString(),
updatedAt: order.updatedAt.toISOString(),
};