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; }