new endpoints
This commit is contained in:
@@ -196,11 +196,16 @@ export class OrderService {
|
||||
}
|
||||
|
||||
|
||||
async findUserOrders(userId: string, dto: FindOrdersDto) {
|
||||
async findOrdersAsUser(userId: string, dto: FindOrdersDto) {
|
||||
const orders = await this.orderRepository.findAllPaginated({ userId, ...dto })
|
||||
return orders
|
||||
}
|
||||
|
||||
async findOrdersAsAdmin(dto: FindOrdersDto) {
|
||||
const orders = await this.orderRepository.findAllPaginated(dto)
|
||||
return orders
|
||||
}
|
||||
|
||||
// async calculateOrder(inputOrder?: Order, orderId?: string) {
|
||||
// let order: undefined | Order = inputOrder
|
||||
|
||||
@@ -316,7 +321,7 @@ export class OrderService {
|
||||
|
||||
private async createOrderItemEntity(order: Order, dto: CreateOrderItemPopulated, em?: EntityManager) {
|
||||
const { attributes, description, quantity, attachments, discount,
|
||||
unitPrice, product, designer, print, printAttachments } = dto
|
||||
unitPrice, product, designer, printAttributes, printAttachments } = dto
|
||||
|
||||
const eM = em ?? this.em
|
||||
return eM.create(
|
||||
@@ -331,7 +336,7 @@ export class OrderService {
|
||||
discount,
|
||||
unitPrice,
|
||||
product,
|
||||
print,
|
||||
printAttributes: printAttributes,
|
||||
printAttachments
|
||||
})
|
||||
}
|
||||
@@ -441,7 +446,7 @@ export class OrderService {
|
||||
|
||||
async updateOrderItem(orderItem: OrderItem, dto: UpdateOrderItem) {
|
||||
const { attributes, description, product, quantity,
|
||||
attachments, discount, unitPrice, designer, print, printAttachments } = dto
|
||||
attachments, discount, unitPrice, designer, printAttributes, printAttachments } = dto
|
||||
|
||||
if (product && orderItem.product.id !== product.id) {
|
||||
orderItem.product = product
|
||||
@@ -475,8 +480,8 @@ export class OrderService {
|
||||
orderItem.unitPrice = unitPrice
|
||||
}
|
||||
|
||||
if (print != undefined) {
|
||||
orderItem.print = print
|
||||
if (printAttributes != undefined) {
|
||||
orderItem.printAttributes = printAttributes
|
||||
}
|
||||
|
||||
if (attributes != undefined) {
|
||||
|
||||
Reference in New Issue
Block a user