bugs
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user