fix(build): resolve linter and tsconfig project service errors, guarantee dist/main existence in start-dev
Deploy Canina / deploy (push) Has been cancelled
Deploy Canina / deploy (push) Has been cancelled
This commit is contained in:
1 parent
a291fa0c4a
commit
6362750dea
50 files changed
+12128
-10959
No files matched your search
@@ -187,7 +187,9 @@ export class OrdersController {
|
||||
},
|
||||
})
|
||||
@Post(':id/retry-payment')
|
||||
@ApiOperation({ summary: 'پرداخت مجدد و تکمیل سفارش با امکان انتخاب روش پرداخت' })
|
||||
@ApiOperation({
|
||||
summary: 'پرداخت مجدد و تکمیل سفارش با امکان انتخاب روش پرداخت',
|
||||
})
|
||||
@ApiOkResponse({
|
||||
description: 'درخواست پرداخت مجدد با موفقیت پردازش شد',
|
||||
})
|
||||
@@ -196,7 +198,11 @@ export class OrdersController {
|
||||
@Param('id') id: string,
|
||||
@Body() body: { paymentMethod?: string },
|
||||
) {
|
||||
return this.ordersService.retryPayment(req.user.id, id, body?.paymentMethod);
|
||||
return this.ordersService.retryPayment(
|
||||
req.user.id,
|
||||
id,
|
||||
body?.paymentMethod,
|
||||
);
|
||||
}
|
||||
|
||||
findOne(@Req() req: { user: { id: string } }, @Param('id') id: string) {
|
||||
|
||||
@@ -104,10 +104,15 @@ export class OrdersService {
|
||||
where: { key: { in: ['catalog_mode', 'catalog_disable_checkout'] } },
|
||||
});
|
||||
const catalogUiText = await this.prisma.uiText.findFirst({
|
||||
where: { key: { in: ['catalog_mode', 'catalog_disable_checkout'] }, value: 'true' },
|
||||
where: {
|
||||
key: { in: ['catalog_mode', 'catalog_disable_checkout'] },
|
||||
value: 'true',
|
||||
},
|
||||
});
|
||||
if ((catalogSetting && String(catalogSetting.value) === 'true') || catalogUiText) {
|
||||
throw new BadRequestException('امکان ثبت سفارش به دلیل فعال بودن حالت کاتالوگ در حال حاضر وجود ندارد.');
|
||||
if ((catalogSetting && catalogSetting.value === 'true') || catalogUiText) {
|
||||
throw new BadRequestException(
|
||||
'امکان ثبت سفارش به دلیل فعال بودن حالت کاتالوگ در حال حاضر وجود ندارد.',
|
||||
);
|
||||
}
|
||||
|
||||
if (!createOrderDto.items || createOrderDto.items.length === 0) {
|
||||
@@ -424,15 +429,16 @@ export class OrdersService {
|
||||
*/
|
||||
async releaseExpiredInventoryReservations() {
|
||||
const now = new Date();
|
||||
const expiredReservations = await this.prisma.inventoryReservation.updateMany({
|
||||
where: {
|
||||
status: 'ACTIVE',
|
||||
expiresAt: { lte: now },
|
||||
},
|
||||
data: {
|
||||
status: 'RELEASED',
|
||||
},
|
||||
});
|
||||
const expiredReservations =
|
||||
await this.prisma.inventoryReservation.updateMany({
|
||||
where: {
|
||||
status: 'ACTIVE',
|
||||
expiresAt: { lte: now },
|
||||
},
|
||||
data: {
|
||||
status: 'RELEASED',
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
releasedCount: expiredReservations.count,
|
||||
@@ -443,11 +449,7 @@ export class OrdersService {
|
||||
/**
|
||||
* Retry or complete payment for an existing pending order with selectable payment method
|
||||
*/
|
||||
async retryPayment(
|
||||
userId: string,
|
||||
orderId: string,
|
||||
paymentMethod?: string,
|
||||
) {
|
||||
async retryPayment(userId: string, orderId: string, paymentMethod?: string) {
|
||||
const order = await this.prisma.order.findFirst({
|
||||
where: { id: orderId, userId },
|
||||
include: { user: true },
|
||||
@@ -494,7 +496,11 @@ export class OrdersService {
|
||||
if (Number(order.charityDonation) > 0) {
|
||||
await tx.user.update({
|
||||
where: { id: userId },
|
||||
data: { charityDonationTotal: { increment: Number(order.charityDonation) } },
|
||||
data: {
|
||||
charityDonationTotal: {
|
||||
increment: Number(order.charityDonation),
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -535,7 +541,8 @@ export class OrdersService {
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: 'روش پرداخت به کارت به کارت تغییر یافت. لطفاً پس از واریز فیش را ثبت فرمایید.',
|
||||
message:
|
||||
'روش پرداخت به کارت به کارت تغییر یافت. لطفاً پس از واریز فیش را ثبت فرمایید.',
|
||||
paymentMethod: 'card',
|
||||
orderId: order.id,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user