Ship deploy build for multi-company order items.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-15 10:38:10 +03:30
co-authored by Cursor
parent 551fd6f06a
commit 0903a1c1e9
17 changed files with 203 additions and 46 deletions
+12 -3
View File
@@ -105,9 +105,16 @@ let CartsService = class CartsService {
if (!item)
throw new common_1.NotFoundException('آیتم سبد یافت نشد');
await this.prisma.cartItem.delete({ where: { id: itemId } });
const remaining = await this.prisma.cartItem.findMany({
where: { cartId: cart.id },
take: 1,
});
await this.prisma.cart.update({
where: { id: cart.id },
data: { updatedAt: new Date() },
data: {
companyId: remaining[0]?.companyId ?? null,
updatedAt: new Date(),
},
});
return this.getCart(userId);
}
@@ -151,12 +158,14 @@ let CartsService = class CartsService {
return cart;
}
mapCart(cart) {
const companyName = cart.items[0]?.companyName;
const companyNames = [
...new Set(cart.items.map((item) => item.companyName).filter(Boolean)),
];
return {
id: cart.id,
userId: cart.userId,
companyId: cart.companyId ?? cart.items[0]?.companyId,
companyName: companyName ?? '',
companyName: companyNames.join('، '),
notes: cart.notes ?? undefined,
items: cart.items.map((item) => ({
id: item.id,
+1 -1
View File
File diff suppressed because one or more lines are too long