mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat: deleteIfNoRelations
This commit is contained in:
@@ -39,11 +39,8 @@ export class DeleteItemService {
|
||||
// Retrieve the given item or throw not found service error.
|
||||
const oldItem = await this.itemModel()
|
||||
.query()
|
||||
.findById(itemId)
|
||||
.throwIfNotFound();
|
||||
// .queryAndThrowIfHasRelations({
|
||||
// type: ERRORS.ITEM_HAS_ASSOCIATED_TRANSACTIONS,
|
||||
// });
|
||||
.findOne('id', itemId)
|
||||
.deleteIfNoRelations();
|
||||
|
||||
// Delete item in unit of work.
|
||||
return this.uow.withTransaction(async (trx: Knex.Transaction) => {
|
||||
|
||||
Reference in New Issue
Block a user