From a979d3d5013c325ca89bc0a606a36fc0edc2ce77 Mon Sep 17 00:00:00 2001 From: Abhinav Kumar Date: Thu, 10 Oct 2024 01:40:02 +0530 Subject: [PATCH] chore!: remove deprecated livechat:getAgentOverviewData method (#33445) --- .changeset/mean-readers-join.md | 5 +++ apps/meteor/app/livechat/server/index.ts | 1 - .../server/methods/getAgentOverviewData.ts | 35 ------------------- 3 files changed, 5 insertions(+), 36 deletions(-) create mode 100644 .changeset/mean-readers-join.md delete mode 100644 apps/meteor/app/livechat/server/methods/getAgentOverviewData.ts diff --git a/.changeset/mean-readers-join.md b/.changeset/mean-readers-join.md new file mode 100644 index 000000000000..f78af9a3c566 --- /dev/null +++ b/.changeset/mean-readers-join.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': major +--- + +Removes deprecated `livechat:getAgentOverviewData` method. Moving forward use `livechat/analytics/agent-overview` endpoint. diff --git a/apps/meteor/app/livechat/server/index.ts b/apps/meteor/app/livechat/server/index.ts index 52082e8b7143..651fbdbcfa69 100644 --- a/apps/meteor/app/livechat/server/index.ts +++ b/apps/meteor/app/livechat/server/index.ts @@ -20,7 +20,6 @@ import './hooks/afterSaveOmnichannelMessage'; import './methods/changeLivechatStatus'; import './methods/closeRoom'; import './methods/discardTranscript'; -import './methods/getAgentOverviewData'; import './methods/getAnalyticsChartData'; import './methods/getAnalyticsOverviewData'; import './methods/getNextAgent'; diff --git a/apps/meteor/app/livechat/server/methods/getAgentOverviewData.ts b/apps/meteor/app/livechat/server/methods/getAgentOverviewData.ts deleted file mode 100644 index 819bac03c5b4..000000000000 --- a/apps/meteor/app/livechat/server/methods/getAgentOverviewData.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { ConversationData } from '@rocket.chat/core-services'; -import { OmnichannelAnalytics } from '@rocket.chat/core-services'; -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { Users } from '@rocket.chat/models'; -import { Meteor } from 'meteor/meteor'; - -import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:getAgentOverviewData'(options: { chartOptions: { name: string } }): ConversationData | void; - } -} - -Meteor.methods({ - async 'livechat:getAgentOverviewData'(options) { - methodDeprecationLogger.method('livechat:getAgentOverviewData', '7.0.0', ' Use "livechat/analytics/agent-overview" instead.'); - - const uid = Meteor.userId(); - if (!uid || !(await hasPermissionAsync(uid, 'view-livechat-manager'))) { - throw new Meteor.Error('error-not-allowed', 'Not allowed', { - method: 'livechat:getAgentOverviewData', - }); - } - - if (!options.chartOptions?.name) { - return; - } - - const user = await Users.findOneById(uid, { projection: { _id: 1, utcOffset: 1 } }); - return OmnichannelAnalytics.getAgentOverviewData({ ...options, utcOffset: user?.utcOffset || 0 }); - }, -});