feat: remove parent item category from item categories service.

This commit is contained in:
Ahmed Bouhuolia
2020-12-02 17:38:49 +02:00
parent e0f1b71930
commit ac6904daaa
5 changed files with 1 additions and 22 deletions

View File

@@ -99,9 +99,6 @@ export default class ItemCategoriesService implements IItemCategoriesService {
if (itemCategoryOTD.inventoryAccountId) {
await this.validateInventoryAccount(tenantId, itemCategoryOTD.inventoryAccountId);
}
if (itemCategoryOTD.parentCategoryId) {
await this.getItemCategoryOrThrowError(tenantId, itemCategoryOTD.parentCategoryId);
}
const itemCategoryObj = this.transformOTDToObject(itemCategoryOTD, authorizedUser);
const itemCategory = await ItemCategory.query().insert({ ...itemCategoryObj });
@@ -203,10 +200,6 @@ export default class ItemCategoriesService implements IItemCategoriesService {
if (itemCategoryOTD.inventoryAccountId) {
await this.validateInventoryAccount(tenantId, itemCategoryOTD.inventoryAccountId);
}
if (itemCategoryOTD.parentCategoryId) {
await this.getItemCategoryOrThrowError(tenantId, itemCategoryOTD.parentCategoryId);
}
const itemCategoryObj = this.transformOTDToObject(itemCategoryOTD, authorizedUser);
const itemCategory = await ItemCategory.query().patchAndFetchById(itemCategoryId, { ...itemCategoryObj });