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