reintroduced update for draft order
This commit is contained in:
@@ -206,4 +206,9 @@ describe("DraftOrderService", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("update", () => {
|
||||
|
||||
fail('implement tests for update');
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
@@ -338,33 +338,33 @@ class DraftOrderService extends BaseService {
|
||||
})
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {String} doId
|
||||
* @param {} data
|
||||
* @returns
|
||||
* Updates a draft order with the given data
|
||||
* @param {String} doId - id of the draft order
|
||||
* @param {DraftOrder} data - values to update the order with
|
||||
* @returns {Promise<DraftOrder>} the updated draft order
|
||||
*/
|
||||
async update(doId, data){
|
||||
return this.atomicPhase_(async manager => {
|
||||
// const doRepo = manager.getCustomRepository(this.draftOrderRepository_)
|
||||
// const draftOrder = await this.retrieve(doId)
|
||||
// let touched = false
|
||||
const doRepo = manager.getCustomRepository(this.draftOrderRepository_)
|
||||
const draftOrder = await this.retrieve(doId)
|
||||
let touched = false
|
||||
|
||||
// if(data.no_notification_order !== undefined){
|
||||
// touched = true
|
||||
// draftOrder.no_notification_order = data.no_notification_order
|
||||
// }
|
||||
if(data.no_notification_order !== undefined){
|
||||
touched = true
|
||||
draftOrder.no_notification_order = data.no_notification_order
|
||||
}
|
||||
|
||||
// if(touched){
|
||||
// doRepo.save(draftOrder)
|
||||
if(touched){
|
||||
doRepo.save(draftOrder)
|
||||
|
||||
// await this.eventBus_
|
||||
// .withTransaction(manager)
|
||||
// .emit(DraftOrderService.Events.UPDATED, {
|
||||
// id: draftOrder.id
|
||||
// })
|
||||
// }
|
||||
await this.eventBus_
|
||||
.withTransaction(manager)
|
||||
.emit(DraftOrderService.Events.UPDATED, {
|
||||
id: draftOrder.id
|
||||
})
|
||||
}
|
||||
|
||||
// return draftOrder
|
||||
return draftOrder
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user