feat(F-102): completed feature

This commit is contained in:
chattie
2026-08-21 12:02:15 +02:00
parent e46faa869a
commit 027cacd871
31 changed files with 510 additions and 80 deletions

View File

@@ -10,6 +10,8 @@ interface MethodRow {
name: string;
base_cost_cents: number;
free_shipping_threshold_cents: number | null;
max_weight_kg: string | number | null;
free_shipping_max_weight_kg: string | number | null;
active: boolean;
}
@@ -20,6 +22,8 @@ interface ZoneMatch {
name: string;
baseCostCents: number;
freeShippingThresholdCents: number | null;
maxWeightKg: number | null;
freeShippingMaxWeightKg: number | null;
active: boolean;
}>;
}
@@ -40,7 +44,8 @@ export class PgShippingRepository implements ShippingRepository {
if (!best) return undefined;
const methods = await this.pool.query<MethodRow>(
`SELECT id, name, base_cost_cents, free_shipping_threshold_cents, active
`SELECT id, name, base_cost_cents, free_shipping_threshold_cents,
max_weight_kg, free_shipping_max_weight_kg, active
FROM shipping_methods WHERE zone_id = $1`,
[best.id],
);
@@ -51,6 +56,9 @@ export class PgShippingRepository implements ShippingRepository {
name: row.name,
baseCostCents: row.base_cost_cents,
freeShippingThresholdCents: row.free_shipping_threshold_cents,
maxWeightKg: row.max_weight_kg === null ? null : Number(row.max_weight_kg),
freeShippingMaxWeightKg:
row.free_shipping_max_weight_kg === null ? null : Number(row.free_shipping_max_weight_kg),
active: row.active,
})),
};