From 0bb7d1d350b319b23a178887fca2f9f0194c14b6 Mon Sep 17 00:00:00 2001 From: Leaves Date: Mon, 25 Mar 2024 08:32:01 +0000 Subject: [PATCH] Fix error when created multiple items with the same unique ID (!269) Fixes issue #592 https://dev.sp-tarkov.com/SPT-AKI/Issues/issues/592 Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/269 Co-authored-by: Leaves Co-committed-by: Leaves --- project/src/models/spt/mod/NewItemDetails.ts | 1 + project/src/services/mod/CustomItemService.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/project/src/models/spt/mod/NewItemDetails.ts b/project/src/models/spt/mod/NewItemDetails.ts index 3b9c60c5..3ba66224 100644 --- a/project/src/models/spt/mod/NewItemDetails.ts +++ b/project/src/models/spt/mod/NewItemDetails.ts @@ -53,6 +53,7 @@ export class CreateItemResult constructor() { this.success = false; + this.errors = []; } success: boolean; diff --git a/project/src/services/mod/CustomItemService.ts b/project/src/services/mod/CustomItemService.ts index 69fc9363..2f5954d5 100644 --- a/project/src/services/mod/CustomItemService.ts +++ b/project/src/services/mod/CustomItemService.ts @@ -55,6 +55,9 @@ export class CustomItemService if (tables.templates.items[newItemId]) { result.errors.push(`ItemId already exists. ${tables.templates.items[newItemId]._name}`); + result.success = false; + result.itemId = newItemId; + return result; }