This commit is contained in:
2026-01-18 17:28:53 +03:30
parent a10b6129b9
commit 8db3b8d1ac
8 changed files with 55 additions and 97 deletions
+4 -7
View File
@@ -1,10 +1,7 @@
import { Injectable, NotFoundException, BadRequestException, Logger } from '@nestjs/common';
import { EntityManager } from '@mikro-orm/postgresql';
import { Order } from '../entities/order.entity';
import { OrderItem } from '../entities/order-item.entity';
import { User } from '../../user/entities/user.entity';
import { PaymentMethodEnum, PaymentStatusEnum } from '../../payment/interface/payment';
import { PaymentsService } from '../../payment/services/payments.service';
import { PaymentService } from '../../payment/services/payments.service';
import { OrderRepository } from '../repositories/order.repository';
import { FindOrdersDto } from '../dto/find-orders.dto';
import { PaginatedResult } from 'src/common/interfaces/pagination.interface';
@@ -32,7 +29,7 @@ export class OrderService {
private readonly em: EntityManager,
private readonly orderRepository: OrderRepository,
private readonly orderItemRepository: OrderItemRepository,
private readonly paymentsService: PaymentsService,
// private readonly paymentsService: PaymentService,
private readonly userService: UserService,
private readonly productService: ProductService,
private readonly productRepository: ProductRepository,
@@ -167,7 +164,7 @@ export class OrderService {
}
async confirmOrderItem(userId: string, orderId: string, orderItemId: number) {
const orderItem = await this.orderItemRepository.findOne({ id: orderItemId, order: { id: orderId } },
{ populate: ['order', 'order.user'] })
@@ -179,7 +176,7 @@ export class OrderService {
throw new BadRequestException("Order Item does not belong to you")
}
orderItem.status=OrderItemStatus.CONFIRMED
orderItem.status = OrderItemStatus.CONFIRMED
this.em.persistAndFlush(OrderItem)