order item

This commit is contained in:
2026-02-06 20:26:10 +03:30
parent 94aa6ba5e5
commit 6fda27491b
4 changed files with 28 additions and 50 deletions
+1 -39
View File
@@ -85,7 +85,7 @@ export class OrderService {
// return updateOrder
}
//TODO : clean
async updateOrderAsAdmin2(orderId: string, dto: UpdateOrderAsAdminDto) {
const order = await this.findOrderOrFail(orderId)
@@ -324,44 +324,6 @@ export class OrderService {
return orders
}
// async calculateOrder(inputOrder?: Order, orderId?: string) {
// let order: undefined | Order = inputOrder
// if (!order && orderId) {
// order = await this.findOneOrFail(orderId)
// }
// if (!order) {
// throw new BadRequestException("Order not found")
// }
// // calculate order financials
// const subTotal = order.items.reduce((sum, item) => {
// return sum + item.subTotal
// }, 0)
// const totalDiscount = order.items.reduce((sum, item) => {
// return sum + Number(item.discount)
// }, 0)
// const totalBeforeTax = subTotal - totalDiscount
// let tax = 0
// if (order.enableTax) {
// tax = 0.1 * totalBeforeTax
// }
// const total = totalBeforeTax + tax
// // Update Order financial values
// // order.subTotal = subTotal
// // order.discount = totalDiscount
// // order.taxAmount = tax
// // order.total = total
// // order.balance = total - paidAmount
// return order
// }
async confirmOrderItem(userId: string, orderId: string, orderItemId: string) {