feat(F-153): completed feature

This commit is contained in:
chattie
2026-08-22 07:41:08 +02:00
parent 569815fd87
commit 4b799f5c1b
16 changed files with 418 additions and 141 deletions

View File

@@ -262,11 +262,8 @@ export async function registerOrdersRoutes(
let notified = false;
let notificationError = '';
try {
const emailRow = await deps.pool.query<{ email: string }>(
'SELECT email FROM identity_users WHERE id = $1',
[order.userId],
);
const to = emailRow.rows[0]?.email;
// F-153: email is now associated on the order view via a repository join.
const to = order.email;
if (to) {
await sendOrderStatusEmail(deps.pool, {
to,
@@ -504,6 +501,7 @@ function serializeOrder(order: {
updatedAt: Date;
idempotencyKey: string | null;
userId?: string;
email?: string | null;
items: Array<{
id: string;
productId: string;
@@ -521,6 +519,7 @@ function serializeOrder(order: {
return {
id: order.id,
userId: order.userId,
email: order.email ?? null,
state: order.state,
currency: order.currency,
subtotalCents: order.subtotalCents,