From 19df4e70538c28ba0d2c719900ee7255e3480d09 Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Mon, 9 Dec 2024 09:49:31 -0600 Subject: [PATCH] cr --- .../server/hooks/afterRemoveDepartment.ts | 2 +- apps/meteor/ee/server/models/raw/LivechatUnit.ts | 11 ----------- .../model-typings/src/models/ILivechatUnitModel.ts | 1 - 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/apps/meteor/ee/app/livechat-enterprise/server/hooks/afterRemoveDepartment.ts b/apps/meteor/ee/app/livechat-enterprise/server/hooks/afterRemoveDepartment.ts index 41c5398e4d83..64d92cca5f1e 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/hooks/afterRemoveDepartment.ts +++ b/apps/meteor/ee/app/livechat-enterprise/server/hooks/afterRemoveDepartment.ts @@ -21,7 +21,7 @@ const afterRemoveDepartment = async (options: { }); await Promise.all([ LivechatDepartment.removeDepartmentFromForwardListById(department._id), - ...(department.parentId ? [LivechatUnit.removeDepartmentFromUnit(department.parentId)] : []), + ...(department.parentId ? [LivechatUnit.decrementDepartmentsCount(department.parentId)] : []), ]); return options; diff --git a/apps/meteor/ee/server/models/raw/LivechatUnit.ts b/apps/meteor/ee/server/models/raw/LivechatUnit.ts index 8e534af429fd..c198ee04fbb0 100644 --- a/apps/meteor/ee/server/models/raw/LivechatUnit.ts +++ b/apps/meteor/ee/server/models/raw/LivechatUnit.ts @@ -190,15 +190,4 @@ export class LivechatUnitRaw extends BaseRaw implement countUnits(): Promise { return this.col.countDocuments({ type: 'u' }); } - - removeDepartmentFromUnit(unitId: string): Promise { - return this.updateOne( - { - _id: unitId, - }, - { - $inc: { numDepartments: -1 }, - }, - ); - } } diff --git a/packages/model-typings/src/models/ILivechatUnitModel.ts b/packages/model-typings/src/models/ILivechatUnitModel.ts index 66736a71b715..24a482eccd0e 100644 --- a/packages/model-typings/src/models/ILivechatUnitModel.ts +++ b/packages/model-typings/src/models/ILivechatUnitModel.ts @@ -39,5 +39,4 @@ export interface ILivechatUnitModel extends IBaseModel findByMonitorId(monitorId: string): Promise; findMonitoredDepartmentsByMonitorId(monitorId: string, includeDisabled: boolean): Promise; countUnits(): Promise; - removeDepartmentFromUnit(unitId: string): Promise; }