This commit is contained in:
Ahmed Bouhuolia
2025-11-19 23:42:06 +02:00
parent 5eafd23bf8
commit d90b6ffbe7
52 changed files with 161 additions and 261 deletions

View File

@@ -24,18 +24,22 @@ export class DeleteSaleEstimate {
private readonly eventPublisher: EventEmitter2,
private readonly uow: UnitOfWork,
) {}
) { }
/**
* Deletes the given estimate id with associated entries.
* @async
* @param {number} estimateId
* @param {number} estimateId - Sale estimate id.
* @param {Knex.Transaction} trx - Database transaction instance.
* @return {Promise<void>}
*/
public async deleteEstimate(estimateId: number): Promise<void> {
public async deleteEstimate(
estimateId: number,
trx?: Knex.Transaction,
): Promise<void> {
// Retrieve sale estimate or throw not found service error.
const oldSaleEstimate = await this.saleEstimateModel()
.query()
.query(trx)
.findById(estimateId)
.throwIfNotFound();
@@ -70,6 +74,6 @@ export class DeleteSaleEstimate {
oldSaleEstimate,
trx,
} as ISaleEstimateDeletedPayload);
});
}, trx);
}
}