user refactor

This commit is contained in:
2026-01-31 16:54:36 +03:30
parent 23ace8ce69
commit c92d5a8068
11 changed files with 128 additions and 232 deletions
+12 -13
View File
@@ -476,27 +476,27 @@ export class OrderService {
orderItem.designer = designer
}
if (attributes) {
if (attributes != undefined) {
orderItem.attributes = attributes
}
if (printAttachments) {
if (printAttachments != undefined) {
orderItem.printAttachments = printAttachments
}
if (description) {
if (description != undefined) {
orderItem.description = description
}
if (quantity) {
if (quantity != undefined) {
orderItem.quantity = quantity
}
if (attachments) {
if (attachments != undefined) {
orderItem.attachments = attachments
}
if (discount) {
if (discount != undefined) {
orderItem.discount = discount
}
if (unitPrice) {
if (unitPrice != undefined) {
orderItem.unitPrice = unitPrice
}
@@ -504,10 +504,6 @@ export class OrderService {
orderItem.printAttributes = printAttributes
}
if (attributes != undefined) {
orderItem.attributes = attributes
}
await this.em.flush()
return orderItem
@@ -526,10 +522,13 @@ export class OrderService {
if (order.payments.length > 0) {
throw new BadRequestException("order with payments can not be deleted!")
}
await this.em.transactional(async (em) => {
await this.ticketRepository.nativeDelete({ orderItem: { order: { id: orderId } } })
await this.orderRepository.nativeDelete(order)
await this.orderItemRepository.nativeDelete({ order: { id: orderId } })
// await this.ticketRepository.nativeDelete({ orderItemorder: { id: orderId } })
// order item will be deleted because cascade is true
// TODO : images also must be deleted
await em.flush()
})