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
+8 -2
View File
@@ -32,7 +32,7 @@ let CashPaymentsService = class CashPaymentsService {
async submitReceipt(userId, orderId, dto) {
const order = await this.prisma.order.findUnique({
where: { id: orderId },
include: { cashReceipt: true },
include: { cashReceipt: true, items: true },
});
if (!order)
throw new common_1.NotFoundException('سفارش یافت نشد');
@@ -49,10 +49,16 @@ let CashPaymentsService = class CashPaymentsService {
order.cashInvoiceExpiresAt.getTime() < Date.now()) {
throw new common_1.BadRequestException('مهلت پرداخت فاکتور نقدی به پایان رسیده است');
}
const companyIds = [
...new Set([
order.companyId,
...order.items.map((item) => item.companyId).filter(Boolean),
].filter(Boolean)),
];
const account = await this.prisma.bankAccount.findFirst({
where: {
id: dto.destinationAccountId,
companyId: order.companyId,
companyId: { in: companyIds },
isActive: true,
},
});
File diff suppressed because one or more lines are too long