feat(F-185): completed feature
This commit is contained in:
@@ -43,7 +43,12 @@ describe.skipIf(!hasDb)('F-145 reporting payment lines (real PostgreSQL)', () =>
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
// Ensure table exists (migrations already applied).
|
||||
// Ensure FK fixtures and table exist (migrations already applied).
|
||||
await pool.query(
|
||||
`INSERT INTO orders_orders (id, source, user_id)
|
||||
VALUES ('00000000-0000-0000-0000-000000000002', 'pos', NULL)
|
||||
ON CONFLICT (id) DO NOTHING`,
|
||||
);
|
||||
await pool.query(`
|
||||
CREATE TABLE IF NOT EXISTS reporting_payment_lines (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
|
||||
@@ -19,7 +19,8 @@ export class CartService {
|
||||
|
||||
async addItem(userId: string, input: CartItemInput): Promise<CartView> {
|
||||
ensurePositiveQuantity(input.quantity);
|
||||
await this.assertStockAvailable(input.variantId, input.quantity);
|
||||
// Keep unavailable lines visible in the cart so the customer can remove or
|
||||
// replace them; checkout remains the authoritative stock gate.
|
||||
return this.toView(await this.carts.addItem(userId, input));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user