From ed4c49883c159b9a18760e9882a072bc606e95bf Mon Sep 17 00:00:00 2001 From: "a.bouhuolia" Date: Sat, 2 Jan 2021 16:18:54 +0200 Subject: [PATCH] fix: unique item name on edit mode. --- server/src/services/Items/ItemsService.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/src/services/Items/ItemsService.ts b/server/src/services/Items/ItemsService.ts index bec041acd..145d367a0 100644 --- a/server/src/services/Items/ItemsService.ts +++ b/server/src/services/Items/ItemsService.ts @@ -335,6 +335,9 @@ export default class ItemsService implements IItemsService { // Validates the given item existance on the storage. const oldItem = await this.getItemOrThrowError(tenantId, itemId); + // Validate whether the given item name already exists on the storage. + await this.validateItemNameUniquiness(tenantId, itemDTO.name, itemId); + // Validate the item category existance on the storage, if (itemDTO.categoryId) { await this.validateItemCategoryExistance(tenantId, itemDTO.categoryId);