Skip to content
Snippets Groups Projects
Unverified Commit b0630fff authored by Pierre Lehnen's avatar Pierre Lehnen Committed by GitHub
Browse files

chore: remove references to EE code in the stats collector (#32052)

parent d996d0b4
No related branches found
No related tags found
No related merge requests found
import { log } from 'console';
import { Analytics } from '@rocket.chat/core-services';
import type { IStats } from '@rocket.chat/core-typings';
import { License } from '@rocket.chat/license';
import { CannedResponse, OmnichannelServiceLevelAgreements, LivechatRooms, LivechatTag, LivechatUnit, Users } from '@rocket.chat/models';
type ENTERPRISE_STATISTICS = GenericStats & Partial<EEOnlyStats>;
type GenericStats = {
modules: string[];
tags: string[];
seatRequests: number;
};
type EEOnlyStats = {
livechatTags: number;
cannedResponses: number;
priorities: number;
slas: number;
businessUnits: number;
omnichannelPdfTranscriptRequested: number;
omnichannelPdfTranscriptSucceeded: number;
omnichannelRoomsWithSlas: number;
omnichannelRoomsWithPriorities: number;
livechatMonitors: number;
};
type ENTERPRISE_STATISTICS = IStats['enterprise'];
type GenericStats = Pick<ENTERPRISE_STATISTICS, 'modules' | 'tags' | 'seatRequests'>;
type EEOnlyStats = Omit<ENTERPRISE_STATISTICS, keyof GenericStats>;
export async function getStatistics(): Promise<ENTERPRISE_STATISTICS> {
const genericStats: GenericStats = {
......@@ -42,7 +28,6 @@ export async function getStatistics(): Promise<ENTERPRISE_STATISTICS> {
return statistics;
}
// These models are only available on EE license so don't import them inside CE license as it will break the build
async function getEEStatistics(): Promise<EEOnlyStats | undefined> {
if (!License.hasModule('livechat-enterprise')) {
return;
......
......@@ -29,7 +29,6 @@ import {
import { MongoInternals } from 'meteor/mongo';
import moment from 'moment';
import { getStatistics as getEnterpriseStatistics } from '../../../../ee/app/license/server/getStatistics';
import { readSecondaryPreferred } from '../../../../server/database/readSecondaryPreferred';
import { isRunningMs } from '../../../../server/lib/isRunningMs';
import { getControl } from '../../../../server/lib/migrations';
......@@ -40,6 +39,7 @@ import { settings } from '../../../settings/server';
import { Info } from '../../../utils/rocketchat.info';
import { getMongoInfo } from '../../../utils/server/functions/getMongoInfo';
import { getAppsStatistics } from './getAppsStatistics';
import { getStatistics as getEnterpriseStatistics } from './getEEStatistics';
import { getImporterStatistics } from './getImporterStatistics';
import { getServicesStatistics } from './getServicesStatistics';
......
......@@ -159,6 +159,11 @@ export interface IStats {
priorities?: number;
slas?: number;
businessUnits?: number;
omnichannelPdfTranscriptRequested?: number;
omnichannelPdfTranscriptSucceeded?: number;
omnichannelRoomsWithSlas?: number;
omnichannelRoomsWithPriorities?: number;
livechatMonitors?: number;
};
createdAt: Date | string;
totalOTR: number;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment