Fix e-payment settings payload, cart race, and media/content helpers.

Stop returning passwordSet (forbidNonWhitelisted), upsert carts safely, and harden related media/product/workshop flows.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-25 16:41:00 +03:30
co-authored by Cursor
parent ad6f9dcf1d
commit 20cc0bbd78
12 changed files with 220 additions and 42 deletions
+5 -10
View File
@@ -279,21 +279,16 @@ export class CartService {
}
private async getOrCreateCart(businessId: bigint, userId: bigint) {
const existing = await this.prisma.cart.findUnique({
// Concurrent GETs (e.g. React Strict Mode) can race on create; upsert is safe.
const cart = await this.prisma.cart.upsert({
where: {
businessId_userId: { businessId, userId },
},
create: { businessId, userId },
update: {},
});
if (existing) {
return this.loadCart(existing.id);
}
const created = await this.prisma.cart.create({
data: { businessId, userId },
});
return this.loadCart(created.id);
return this.loadCart(cart.id);
}
private async loadCart(cartId: bigint): Promise<CartWithItems> {