order item get
This commit is contained in:
@@ -102,7 +102,7 @@ export class OrderService {
|
||||
|
||||
const { designerId, productId, ...itemRest } = item
|
||||
|
||||
let newProduct=currentItem.product
|
||||
let newProduct = currentItem.product
|
||||
|
||||
if (productId && productId !== currentItem.product.id) {
|
||||
|
||||
@@ -446,7 +446,7 @@ export class OrderService {
|
||||
const admin = adminId ? await this.adminService.findOrFail(adminId) : undefined
|
||||
const products = await this.productService.findProductsByIds(items.map(item => item.productId))
|
||||
const desiners = await this.adminService.findByIds(items.map(item => item.designerId).filter(id => id != null))
|
||||
|
||||
|
||||
const productMap = new Map(
|
||||
products.map(p => [Number(p.id), p])
|
||||
);
|
||||
@@ -629,4 +629,13 @@ export class OrderService {
|
||||
return orderItem
|
||||
}
|
||||
|
||||
async findOrderItemOrFailByItemId(itemId: number) {
|
||||
const orderItem = await this.orderItemRepository.findOne({ id: itemId },
|
||||
{ populate: ['order', 'order.user'] })
|
||||
if (!orderItem) {
|
||||
throw new BadRequestException('Order item not found')
|
||||
}
|
||||
return orderItem
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user