feat: journal entries with expenses operations.

This commit is contained in:
a.bouhuolia
2021-01-03 12:47:20 +02:00
parent f18ab184e2
commit a2284945f1
9 changed files with 658 additions and 303 deletions

View File

@@ -400,7 +400,11 @@ export default class ItemsService implements IItemsService {
const { Item } = this.tenancy.models(tenantId);
this.logger.info('[items] trying to delete item.', { tenantId, itemId });
// Retreive the given item or throw not found service error.
await this.getItemOrThrowError(tenantId, itemId);
// Validate the item has no associated invoices or bills.
await this.validateHasNoInvoicesOrBills(tenantId, itemId);
await Item.query().findById(itemId).delete();