From 24c80a0d906ce1de230737b11eee6b1e646e4201 Mon Sep 17 00:00:00 2001
From: Diego Sampaio
Date: Thu, 26 Dec 2024 10:54:43 -0300
Subject: [PATCH 01/14] move models classes
---
.../models/src/models}/Analytics.ts | 2 +-
.../models/src/models}/AppLogsModel.ts | 0
.../raw => packages/models/src/models}/Apps.ts | 0
.../models/src/models}/AppsPersistence.ts | 0
.../models/src/models}/AppsTokens.ts | 0
.../models/src/models}/Avatars.ts | 0
.../models/src/models}/Banners.ts | 0
.../models/src/models}/BannersDismiss.ts | 0
.../models/src/models}/BaseRaw.ts | 0
.../models/src/models}/BaseUploadModel.ts | 0
.../models/src/models}/CalendarEvent.ts | 0
.../models/src/models}/CredentialTokens.ts | 0
.../models/src/models}/CronHistoryModel.ts | 0
.../models/src/models}/CustomSounds.ts | 0
.../models/src/models}/CustomUserStatus.ts | 0
.../models/src/models}/EmailInbox.ts | 0
.../models/src/models}/EmailMessageHistory.ts | 0
.../models/src/models}/EmojiCustom.ts | 0
.../models/src/models}/ExportOperations.ts | 0
.../models/src/models}/FederationEvents.ts | 0
.../models/src/models}/FederationKeys.ts | 0
.../models/src/models}/FederationRoomEvents.ts | 0
.../models/src/models}/FederationServers.ts | 0
.../models/src/models}/FreeSwitchCall.ts | 0
.../models/src/models}/FreeSwitchEvent.ts | 0
.../models/src/models}/ImportData.ts | 0
.../models/src/models}/Imports.ts | 0
.../models/src/models}/InstanceStatus.ts | 0
.../models/src/models}/IntegrationHistory.ts | 0
.../models/src/models}/Integrations.ts | 0
.../models/src/models}/Invites.ts | 0
.../src/models}/LivechatAgentActivity.ts | 2 +-
.../src/models}/LivechatBusinessHours.ts | 0
.../models/src/models}/LivechatContacts.ts | 2 +-
.../models/src/models}/LivechatCustomField.ts | 0
.../models/src/models}/LivechatDepartment.ts | 0
.../src/models}/LivechatDepartmentAgents.ts | 0
.../models/src/models}/LivechatInquiry.ts | 2 +-
.../models/src/models}/LivechatRooms.ts | 2 +-
.../models/src/models}/LivechatTrigger.ts | 0
.../models/src/models}/LivechatVisitors.ts | 0
.../src/models}/LoginServiceConfiguration.ts | 0
.../models/src/models}/MatrixBridgedRoom.ts | 0
.../models/src/models}/MatrixBridgedUser.ts | 0
.../models/src/models}/MessageReads.ts | 0
.../models/src/models}/Messages.ts | 2 +-
.../models/src/models}/Migrations.ts | 0
.../models/src/models}/ModerationReports.ts | 0
.../models/src/models}/NotificationQueue.ts | 0
.../raw => packages/models/src/models}/Nps.ts | 0
.../models/src/models}/NpsVote.ts | 0
.../models/src/models}/OAuthAccessTokens.ts | 0
.../models/src/models}/OAuthApps.ts | 0
.../models/src/models}/OAuthAuthCodes.ts | 0
.../models/src/models}/OAuthRefreshTokens.ts | 0
.../models/src/models}/OEmbedCache.ts | 0
.../models/src/models}/PbxEvents.ts | 0
.../models/src/models}/Permissions.ts | 0
.../models/src/models}/PushToken.ts | 0
.../models/src/models}/Reports.ts | 0
.../models/src/models}/Roles.ts | 0
.../models/src/models}/Rooms.ts | 2 +-
.../models/src/models}/ServerEvents.ts | 0
.../models/src/models}/Sessions.ts | 2 +-
.../models/src/models}/Settings.ts | 0
.../models/src/models}/SmarshHistory.ts | 0
.../models/src/models}/Statistics.ts | 0
.../models/src/models}/Subscriptions.ts | 0
.../raw => packages/models/src/models}/Team.ts | 0
.../models/src/models}/TeamMember.ts | 0
.../models/src/models}/Trash.ts | 0
.../models/src/models}/Uploads.ts | 0
.../models/src/models}/UserDataFiles.ts | 0
.../models/src/models}/Users.js | 0
.../models/src/models}/UsersSessions.ts | 0
.../models/src/models}/VideoConference.ts | 0
.../models/src/models}/VoipRoom.ts | 0
.../models/src/models}/WebdavAccounts.ts | 0
.../models/src/models}/WorkspaceCredentials.ts | 0
.../models/src/models}/setUpdatedAt.ts | 0
packages/models/src/readSecondaryPreferred.ts | 18 ++++++++++++++++++
81 files changed, 26 insertions(+), 8 deletions(-)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Analytics.ts (98%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/AppLogsModel.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Apps.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/AppsPersistence.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/AppsTokens.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Avatars.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Banners.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/BannersDismiss.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/BaseRaw.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/BaseUploadModel.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/CalendarEvent.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/CredentialTokens.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/CronHistoryModel.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/CustomSounds.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/CustomUserStatus.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/EmailInbox.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/EmailMessageHistory.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/EmojiCustom.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/ExportOperations.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/FederationEvents.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/FederationKeys.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/FederationRoomEvents.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/FederationServers.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/FreeSwitchCall.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/FreeSwitchEvent.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/ImportData.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Imports.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/InstanceStatus.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/IntegrationHistory.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Integrations.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Invites.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/LivechatAgentActivity.ts (98%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/LivechatBusinessHours.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/LivechatContacts.ts (99%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/LivechatCustomField.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/LivechatDepartment.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/LivechatDepartmentAgents.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/LivechatInquiry.ts (99%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/LivechatRooms.ts (99%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/LivechatTrigger.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/LivechatVisitors.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/LoginServiceConfiguration.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/MatrixBridgedRoom.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/MatrixBridgedUser.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/MessageReads.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Messages.ts (99%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Migrations.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/ModerationReports.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/NotificationQueue.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Nps.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/NpsVote.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/OAuthAccessTokens.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/OAuthApps.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/OAuthAuthCodes.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/OAuthRefreshTokens.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/OEmbedCache.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/PbxEvents.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Permissions.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/PushToken.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Reports.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Roles.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Rooms.ts (99%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/ServerEvents.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Sessions.ts (99%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Settings.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/SmarshHistory.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Statistics.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Subscriptions.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Team.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/TeamMember.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Trash.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Uploads.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/UserDataFiles.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/Users.js (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/UsersSessions.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/VideoConference.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/VoipRoom.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/WebdavAccounts.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/WorkspaceCredentials.ts (100%)
rename {apps/meteor/server/models/raw => packages/models/src/models}/setUpdatedAt.ts (100%)
create mode 100644 packages/models/src/readSecondaryPreferred.ts
diff --git a/apps/meteor/server/models/raw/Analytics.ts b/packages/models/src/models/Analytics.ts
similarity index 98%
rename from apps/meteor/server/models/raw/Analytics.ts
rename to packages/models/src/models/Analytics.ts
index e7f5a57ec9f4..b95eb23e9e26 100644
--- a/apps/meteor/server/models/raw/Analytics.ts
+++ b/packages/models/src/models/Analytics.ts
@@ -4,7 +4,7 @@ import { Random } from '@rocket.chat/random';
import type { AggregationCursor, FindCursor, Db, IndexDescription, FindOptions, UpdateResult, Document, Collection } from 'mongodb';
import { BaseRaw } from './BaseRaw';
-import { readSecondaryPreferred } from '../../database/readSecondaryPreferred';
+import { readSecondaryPreferred } from '../readSecondaryPreferred';
export class AnalyticsRaw extends BaseRaw implements IAnalyticsModel {
constructor(db: Db) {
diff --git a/apps/meteor/server/models/raw/AppLogsModel.ts b/packages/models/src/models/AppLogsModel.ts
similarity index 100%
rename from apps/meteor/server/models/raw/AppLogsModel.ts
rename to packages/models/src/models/AppLogsModel.ts
diff --git a/apps/meteor/server/models/raw/Apps.ts b/packages/models/src/models/Apps.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Apps.ts
rename to packages/models/src/models/Apps.ts
diff --git a/apps/meteor/server/models/raw/AppsPersistence.ts b/packages/models/src/models/AppsPersistence.ts
similarity index 100%
rename from apps/meteor/server/models/raw/AppsPersistence.ts
rename to packages/models/src/models/AppsPersistence.ts
diff --git a/apps/meteor/server/models/raw/AppsTokens.ts b/packages/models/src/models/AppsTokens.ts
similarity index 100%
rename from apps/meteor/server/models/raw/AppsTokens.ts
rename to packages/models/src/models/AppsTokens.ts
diff --git a/apps/meteor/server/models/raw/Avatars.ts b/packages/models/src/models/Avatars.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Avatars.ts
rename to packages/models/src/models/Avatars.ts
diff --git a/apps/meteor/server/models/raw/Banners.ts b/packages/models/src/models/Banners.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Banners.ts
rename to packages/models/src/models/Banners.ts
diff --git a/apps/meteor/server/models/raw/BannersDismiss.ts b/packages/models/src/models/BannersDismiss.ts
similarity index 100%
rename from apps/meteor/server/models/raw/BannersDismiss.ts
rename to packages/models/src/models/BannersDismiss.ts
diff --git a/apps/meteor/server/models/raw/BaseRaw.ts b/packages/models/src/models/BaseRaw.ts
similarity index 100%
rename from apps/meteor/server/models/raw/BaseRaw.ts
rename to packages/models/src/models/BaseRaw.ts
diff --git a/apps/meteor/server/models/raw/BaseUploadModel.ts b/packages/models/src/models/BaseUploadModel.ts
similarity index 100%
rename from apps/meteor/server/models/raw/BaseUploadModel.ts
rename to packages/models/src/models/BaseUploadModel.ts
diff --git a/apps/meteor/server/models/raw/CalendarEvent.ts b/packages/models/src/models/CalendarEvent.ts
similarity index 100%
rename from apps/meteor/server/models/raw/CalendarEvent.ts
rename to packages/models/src/models/CalendarEvent.ts
diff --git a/apps/meteor/server/models/raw/CredentialTokens.ts b/packages/models/src/models/CredentialTokens.ts
similarity index 100%
rename from apps/meteor/server/models/raw/CredentialTokens.ts
rename to packages/models/src/models/CredentialTokens.ts
diff --git a/apps/meteor/server/models/raw/CronHistoryModel.ts b/packages/models/src/models/CronHistoryModel.ts
similarity index 100%
rename from apps/meteor/server/models/raw/CronHistoryModel.ts
rename to packages/models/src/models/CronHistoryModel.ts
diff --git a/apps/meteor/server/models/raw/CustomSounds.ts b/packages/models/src/models/CustomSounds.ts
similarity index 100%
rename from apps/meteor/server/models/raw/CustomSounds.ts
rename to packages/models/src/models/CustomSounds.ts
diff --git a/apps/meteor/server/models/raw/CustomUserStatus.ts b/packages/models/src/models/CustomUserStatus.ts
similarity index 100%
rename from apps/meteor/server/models/raw/CustomUserStatus.ts
rename to packages/models/src/models/CustomUserStatus.ts
diff --git a/apps/meteor/server/models/raw/EmailInbox.ts b/packages/models/src/models/EmailInbox.ts
similarity index 100%
rename from apps/meteor/server/models/raw/EmailInbox.ts
rename to packages/models/src/models/EmailInbox.ts
diff --git a/apps/meteor/server/models/raw/EmailMessageHistory.ts b/packages/models/src/models/EmailMessageHistory.ts
similarity index 100%
rename from apps/meteor/server/models/raw/EmailMessageHistory.ts
rename to packages/models/src/models/EmailMessageHistory.ts
diff --git a/apps/meteor/server/models/raw/EmojiCustom.ts b/packages/models/src/models/EmojiCustom.ts
similarity index 100%
rename from apps/meteor/server/models/raw/EmojiCustom.ts
rename to packages/models/src/models/EmojiCustom.ts
diff --git a/apps/meteor/server/models/raw/ExportOperations.ts b/packages/models/src/models/ExportOperations.ts
similarity index 100%
rename from apps/meteor/server/models/raw/ExportOperations.ts
rename to packages/models/src/models/ExportOperations.ts
diff --git a/apps/meteor/server/models/raw/FederationEvents.ts b/packages/models/src/models/FederationEvents.ts
similarity index 100%
rename from apps/meteor/server/models/raw/FederationEvents.ts
rename to packages/models/src/models/FederationEvents.ts
diff --git a/apps/meteor/server/models/raw/FederationKeys.ts b/packages/models/src/models/FederationKeys.ts
similarity index 100%
rename from apps/meteor/server/models/raw/FederationKeys.ts
rename to packages/models/src/models/FederationKeys.ts
diff --git a/apps/meteor/server/models/raw/FederationRoomEvents.ts b/packages/models/src/models/FederationRoomEvents.ts
similarity index 100%
rename from apps/meteor/server/models/raw/FederationRoomEvents.ts
rename to packages/models/src/models/FederationRoomEvents.ts
diff --git a/apps/meteor/server/models/raw/FederationServers.ts b/packages/models/src/models/FederationServers.ts
similarity index 100%
rename from apps/meteor/server/models/raw/FederationServers.ts
rename to packages/models/src/models/FederationServers.ts
diff --git a/apps/meteor/server/models/raw/FreeSwitchCall.ts b/packages/models/src/models/FreeSwitchCall.ts
similarity index 100%
rename from apps/meteor/server/models/raw/FreeSwitchCall.ts
rename to packages/models/src/models/FreeSwitchCall.ts
diff --git a/apps/meteor/server/models/raw/FreeSwitchEvent.ts b/packages/models/src/models/FreeSwitchEvent.ts
similarity index 100%
rename from apps/meteor/server/models/raw/FreeSwitchEvent.ts
rename to packages/models/src/models/FreeSwitchEvent.ts
diff --git a/apps/meteor/server/models/raw/ImportData.ts b/packages/models/src/models/ImportData.ts
similarity index 100%
rename from apps/meteor/server/models/raw/ImportData.ts
rename to packages/models/src/models/ImportData.ts
diff --git a/apps/meteor/server/models/raw/Imports.ts b/packages/models/src/models/Imports.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Imports.ts
rename to packages/models/src/models/Imports.ts
diff --git a/apps/meteor/server/models/raw/InstanceStatus.ts b/packages/models/src/models/InstanceStatus.ts
similarity index 100%
rename from apps/meteor/server/models/raw/InstanceStatus.ts
rename to packages/models/src/models/InstanceStatus.ts
diff --git a/apps/meteor/server/models/raw/IntegrationHistory.ts b/packages/models/src/models/IntegrationHistory.ts
similarity index 100%
rename from apps/meteor/server/models/raw/IntegrationHistory.ts
rename to packages/models/src/models/IntegrationHistory.ts
diff --git a/apps/meteor/server/models/raw/Integrations.ts b/packages/models/src/models/Integrations.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Integrations.ts
rename to packages/models/src/models/Integrations.ts
diff --git a/apps/meteor/server/models/raw/Invites.ts b/packages/models/src/models/Invites.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Invites.ts
rename to packages/models/src/models/Invites.ts
diff --git a/apps/meteor/server/models/raw/LivechatAgentActivity.ts b/packages/models/src/models/LivechatAgentActivity.ts
similarity index 98%
rename from apps/meteor/server/models/raw/LivechatAgentActivity.ts
rename to packages/models/src/models/LivechatAgentActivity.ts
index ec9215adf855..c40f5e15e238 100644
--- a/apps/meteor/server/models/raw/LivechatAgentActivity.ts
+++ b/packages/models/src/models/LivechatAgentActivity.ts
@@ -4,7 +4,7 @@ import moment from 'moment';
import type { AggregationCursor, Collection, Document, FindCursor, Db, ModifyResult, IndexDescription, UpdateResult } from 'mongodb';
import { BaseRaw } from './BaseRaw';
-import { readSecondaryPreferred } from '../../database/readSecondaryPreferred';
+import { readSecondaryPreferred } from '../readSecondaryPreferred';
export class LivechatAgentActivityRaw extends BaseRaw implements ILivechatAgentActivityModel {
constructor(db: Db, trash?: Collection>) {
diff --git a/apps/meteor/server/models/raw/LivechatBusinessHours.ts b/packages/models/src/models/LivechatBusinessHours.ts
similarity index 100%
rename from apps/meteor/server/models/raw/LivechatBusinessHours.ts
rename to packages/models/src/models/LivechatBusinessHours.ts
diff --git a/apps/meteor/server/models/raw/LivechatContacts.ts b/packages/models/src/models/LivechatContacts.ts
similarity index 99%
rename from apps/meteor/server/models/raw/LivechatContacts.ts
rename to packages/models/src/models/LivechatContacts.ts
index 43a5f5204e60..ed84fd64d18c 100644
--- a/apps/meteor/server/models/raw/LivechatContacts.ts
+++ b/packages/models/src/models/LivechatContacts.ts
@@ -25,7 +25,7 @@ import type {
} from 'mongodb';
import { BaseRaw } from './BaseRaw';
-import { readSecondaryPreferred } from '../../database/readSecondaryPreferred';
+import { readSecondaryPreferred } from '../readSecondaryPreferred';
export class LivechatContactsRaw extends BaseRaw implements ILivechatContactsModel {
constructor(db: Db, trash?: Collection>) {
diff --git a/apps/meteor/server/models/raw/LivechatCustomField.ts b/packages/models/src/models/LivechatCustomField.ts
similarity index 100%
rename from apps/meteor/server/models/raw/LivechatCustomField.ts
rename to packages/models/src/models/LivechatCustomField.ts
diff --git a/apps/meteor/server/models/raw/LivechatDepartment.ts b/packages/models/src/models/LivechatDepartment.ts
similarity index 100%
rename from apps/meteor/server/models/raw/LivechatDepartment.ts
rename to packages/models/src/models/LivechatDepartment.ts
diff --git a/apps/meteor/server/models/raw/LivechatDepartmentAgents.ts b/packages/models/src/models/LivechatDepartmentAgents.ts
similarity index 100%
rename from apps/meteor/server/models/raw/LivechatDepartmentAgents.ts
rename to packages/models/src/models/LivechatDepartmentAgents.ts
diff --git a/apps/meteor/server/models/raw/LivechatInquiry.ts b/packages/models/src/models/LivechatInquiry.ts
similarity index 99%
rename from apps/meteor/server/models/raw/LivechatInquiry.ts
rename to packages/models/src/models/LivechatInquiry.ts
index de5ebc069949..f79e234db84b 100644
--- a/apps/meteor/server/models/raw/LivechatInquiry.ts
+++ b/packages/models/src/models/LivechatInquiry.ts
@@ -18,7 +18,7 @@ import type {
} from 'mongodb';
import { BaseRaw } from './BaseRaw';
-import { readSecondaryPreferred } from '../../database/readSecondaryPreferred';
+import { readSecondaryPreferred } from '../readSecondaryPreferred';
export class LivechatInquiryRaw extends BaseRaw implements ILivechatInquiryModel {
constructor(db: Db, trash?: Collection>) {
diff --git a/apps/meteor/server/models/raw/LivechatRooms.ts b/packages/models/src/models/LivechatRooms.ts
similarity index 99%
rename from apps/meteor/server/models/raw/LivechatRooms.ts
rename to packages/models/src/models/LivechatRooms.ts
index e1a4d31a2a38..b4a4e89eb7ae 100644
--- a/apps/meteor/server/models/raw/LivechatRooms.ts
+++ b/packages/models/src/models/LivechatRooms.ts
@@ -33,7 +33,7 @@ import type {
} from 'mongodb';
import { BaseRaw } from './BaseRaw';
-import { readSecondaryPreferred } from '../../database/readSecondaryPreferred';
+import { readSecondaryPreferred } from '../readSecondaryPreferred';
/**
* @extends BaseRaw
diff --git a/apps/meteor/server/models/raw/LivechatTrigger.ts b/packages/models/src/models/LivechatTrigger.ts
similarity index 100%
rename from apps/meteor/server/models/raw/LivechatTrigger.ts
rename to packages/models/src/models/LivechatTrigger.ts
diff --git a/apps/meteor/server/models/raw/LivechatVisitors.ts b/packages/models/src/models/LivechatVisitors.ts
similarity index 100%
rename from apps/meteor/server/models/raw/LivechatVisitors.ts
rename to packages/models/src/models/LivechatVisitors.ts
diff --git a/apps/meteor/server/models/raw/LoginServiceConfiguration.ts b/packages/models/src/models/LoginServiceConfiguration.ts
similarity index 100%
rename from apps/meteor/server/models/raw/LoginServiceConfiguration.ts
rename to packages/models/src/models/LoginServiceConfiguration.ts
diff --git a/apps/meteor/server/models/raw/MatrixBridgedRoom.ts b/packages/models/src/models/MatrixBridgedRoom.ts
similarity index 100%
rename from apps/meteor/server/models/raw/MatrixBridgedRoom.ts
rename to packages/models/src/models/MatrixBridgedRoom.ts
diff --git a/apps/meteor/server/models/raw/MatrixBridgedUser.ts b/packages/models/src/models/MatrixBridgedUser.ts
similarity index 100%
rename from apps/meteor/server/models/raw/MatrixBridgedUser.ts
rename to packages/models/src/models/MatrixBridgedUser.ts
diff --git a/apps/meteor/server/models/raw/MessageReads.ts b/packages/models/src/models/MessageReads.ts
similarity index 100%
rename from apps/meteor/server/models/raw/MessageReads.ts
rename to packages/models/src/models/MessageReads.ts
diff --git a/apps/meteor/server/models/raw/Messages.ts b/packages/models/src/models/Messages.ts
similarity index 99%
rename from apps/meteor/server/models/raw/Messages.ts
rename to packages/models/src/models/Messages.ts
index 4736758afbb6..22e3243bdca2 100644
--- a/apps/meteor/server/models/raw/Messages.ts
+++ b/packages/models/src/models/Messages.ts
@@ -31,7 +31,7 @@ import type {
} from 'mongodb';
import { BaseRaw } from './BaseRaw';
-import { readSecondaryPreferred } from '../../database/readSecondaryPreferred';
+import { readSecondaryPreferred } from '../readSecondaryPreferred';
type DeepWritable = T extends (...args: any) => any
? T
diff --git a/apps/meteor/server/models/raw/Migrations.ts b/packages/models/src/models/Migrations.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Migrations.ts
rename to packages/models/src/models/Migrations.ts
diff --git a/apps/meteor/server/models/raw/ModerationReports.ts b/packages/models/src/models/ModerationReports.ts
similarity index 100%
rename from apps/meteor/server/models/raw/ModerationReports.ts
rename to packages/models/src/models/ModerationReports.ts
diff --git a/apps/meteor/server/models/raw/NotificationQueue.ts b/packages/models/src/models/NotificationQueue.ts
similarity index 100%
rename from apps/meteor/server/models/raw/NotificationQueue.ts
rename to packages/models/src/models/NotificationQueue.ts
diff --git a/apps/meteor/server/models/raw/Nps.ts b/packages/models/src/models/Nps.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Nps.ts
rename to packages/models/src/models/Nps.ts
diff --git a/apps/meteor/server/models/raw/NpsVote.ts b/packages/models/src/models/NpsVote.ts
similarity index 100%
rename from apps/meteor/server/models/raw/NpsVote.ts
rename to packages/models/src/models/NpsVote.ts
diff --git a/apps/meteor/server/models/raw/OAuthAccessTokens.ts b/packages/models/src/models/OAuthAccessTokens.ts
similarity index 100%
rename from apps/meteor/server/models/raw/OAuthAccessTokens.ts
rename to packages/models/src/models/OAuthAccessTokens.ts
diff --git a/apps/meteor/server/models/raw/OAuthApps.ts b/packages/models/src/models/OAuthApps.ts
similarity index 100%
rename from apps/meteor/server/models/raw/OAuthApps.ts
rename to packages/models/src/models/OAuthApps.ts
diff --git a/apps/meteor/server/models/raw/OAuthAuthCodes.ts b/packages/models/src/models/OAuthAuthCodes.ts
similarity index 100%
rename from apps/meteor/server/models/raw/OAuthAuthCodes.ts
rename to packages/models/src/models/OAuthAuthCodes.ts
diff --git a/apps/meteor/server/models/raw/OAuthRefreshTokens.ts b/packages/models/src/models/OAuthRefreshTokens.ts
similarity index 100%
rename from apps/meteor/server/models/raw/OAuthRefreshTokens.ts
rename to packages/models/src/models/OAuthRefreshTokens.ts
diff --git a/apps/meteor/server/models/raw/OEmbedCache.ts b/packages/models/src/models/OEmbedCache.ts
similarity index 100%
rename from apps/meteor/server/models/raw/OEmbedCache.ts
rename to packages/models/src/models/OEmbedCache.ts
diff --git a/apps/meteor/server/models/raw/PbxEvents.ts b/packages/models/src/models/PbxEvents.ts
similarity index 100%
rename from apps/meteor/server/models/raw/PbxEvents.ts
rename to packages/models/src/models/PbxEvents.ts
diff --git a/apps/meteor/server/models/raw/Permissions.ts b/packages/models/src/models/Permissions.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Permissions.ts
rename to packages/models/src/models/Permissions.ts
diff --git a/apps/meteor/server/models/raw/PushToken.ts b/packages/models/src/models/PushToken.ts
similarity index 100%
rename from apps/meteor/server/models/raw/PushToken.ts
rename to packages/models/src/models/PushToken.ts
diff --git a/apps/meteor/server/models/raw/Reports.ts b/packages/models/src/models/Reports.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Reports.ts
rename to packages/models/src/models/Reports.ts
diff --git a/apps/meteor/server/models/raw/Roles.ts b/packages/models/src/models/Roles.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Roles.ts
rename to packages/models/src/models/Roles.ts
diff --git a/apps/meteor/server/models/raw/Rooms.ts b/packages/models/src/models/Rooms.ts
similarity index 99%
rename from apps/meteor/server/models/raw/Rooms.ts
rename to packages/models/src/models/Rooms.ts
index d35033ad90f3..137078b6fe87 100644
--- a/apps/meteor/server/models/raw/Rooms.ts
+++ b/packages/models/src/models/Rooms.ts
@@ -30,7 +30,7 @@ import type {
} from 'mongodb';
import { BaseRaw } from './BaseRaw';
-import { readSecondaryPreferred } from '../../database/readSecondaryPreferred';
+import { readSecondaryPreferred } from '../readSecondaryPreferred';
export class RoomsRaw extends BaseRaw implements IRoomsModel {
constructor(db: Db, trash?: Collection>) {
diff --git a/apps/meteor/server/models/raw/ServerEvents.ts b/packages/models/src/models/ServerEvents.ts
similarity index 100%
rename from apps/meteor/server/models/raw/ServerEvents.ts
rename to packages/models/src/models/ServerEvents.ts
diff --git a/apps/meteor/server/models/raw/Sessions.ts b/packages/models/src/models/Sessions.ts
similarity index 99%
rename from apps/meteor/server/models/raw/Sessions.ts
rename to packages/models/src/models/Sessions.ts
index 4a0b72646c77..954818211a5c 100644
--- a/apps/meteor/server/models/raw/Sessions.ts
+++ b/packages/models/src/models/Sessions.ts
@@ -29,7 +29,7 @@ import type {
} from 'mongodb';
import { BaseRaw } from './BaseRaw';
-import { readSecondaryPreferred } from '../../database/readSecondaryPreferred';
+import { readSecondaryPreferred } from '../readSecondaryPreferred';
type DestructuredDate = { year: number; month: number; day: number };
type DestructuredDateWithType = {
diff --git a/apps/meteor/server/models/raw/Settings.ts b/packages/models/src/models/Settings.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Settings.ts
rename to packages/models/src/models/Settings.ts
diff --git a/apps/meteor/server/models/raw/SmarshHistory.ts b/packages/models/src/models/SmarshHistory.ts
similarity index 100%
rename from apps/meteor/server/models/raw/SmarshHistory.ts
rename to packages/models/src/models/SmarshHistory.ts
diff --git a/apps/meteor/server/models/raw/Statistics.ts b/packages/models/src/models/Statistics.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Statistics.ts
rename to packages/models/src/models/Statistics.ts
diff --git a/apps/meteor/server/models/raw/Subscriptions.ts b/packages/models/src/models/Subscriptions.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Subscriptions.ts
rename to packages/models/src/models/Subscriptions.ts
diff --git a/apps/meteor/server/models/raw/Team.ts b/packages/models/src/models/Team.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Team.ts
rename to packages/models/src/models/Team.ts
diff --git a/apps/meteor/server/models/raw/TeamMember.ts b/packages/models/src/models/TeamMember.ts
similarity index 100%
rename from apps/meteor/server/models/raw/TeamMember.ts
rename to packages/models/src/models/TeamMember.ts
diff --git a/apps/meteor/server/models/raw/Trash.ts b/packages/models/src/models/Trash.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Trash.ts
rename to packages/models/src/models/Trash.ts
diff --git a/apps/meteor/server/models/raw/Uploads.ts b/packages/models/src/models/Uploads.ts
similarity index 100%
rename from apps/meteor/server/models/raw/Uploads.ts
rename to packages/models/src/models/Uploads.ts
diff --git a/apps/meteor/server/models/raw/UserDataFiles.ts b/packages/models/src/models/UserDataFiles.ts
similarity index 100%
rename from apps/meteor/server/models/raw/UserDataFiles.ts
rename to packages/models/src/models/UserDataFiles.ts
diff --git a/apps/meteor/server/models/raw/Users.js b/packages/models/src/models/Users.js
similarity index 100%
rename from apps/meteor/server/models/raw/Users.js
rename to packages/models/src/models/Users.js
diff --git a/apps/meteor/server/models/raw/UsersSessions.ts b/packages/models/src/models/UsersSessions.ts
similarity index 100%
rename from apps/meteor/server/models/raw/UsersSessions.ts
rename to packages/models/src/models/UsersSessions.ts
diff --git a/apps/meteor/server/models/raw/VideoConference.ts b/packages/models/src/models/VideoConference.ts
similarity index 100%
rename from apps/meteor/server/models/raw/VideoConference.ts
rename to packages/models/src/models/VideoConference.ts
diff --git a/apps/meteor/server/models/raw/VoipRoom.ts b/packages/models/src/models/VoipRoom.ts
similarity index 100%
rename from apps/meteor/server/models/raw/VoipRoom.ts
rename to packages/models/src/models/VoipRoom.ts
diff --git a/apps/meteor/server/models/raw/WebdavAccounts.ts b/packages/models/src/models/WebdavAccounts.ts
similarity index 100%
rename from apps/meteor/server/models/raw/WebdavAccounts.ts
rename to packages/models/src/models/WebdavAccounts.ts
diff --git a/apps/meteor/server/models/raw/WorkspaceCredentials.ts b/packages/models/src/models/WorkspaceCredentials.ts
similarity index 100%
rename from apps/meteor/server/models/raw/WorkspaceCredentials.ts
rename to packages/models/src/models/WorkspaceCredentials.ts
diff --git a/apps/meteor/server/models/raw/setUpdatedAt.ts b/packages/models/src/models/setUpdatedAt.ts
similarity index 100%
rename from apps/meteor/server/models/raw/setUpdatedAt.ts
rename to packages/models/src/models/setUpdatedAt.ts
diff --git a/packages/models/src/readSecondaryPreferred.ts b/packages/models/src/readSecondaryPreferred.ts
new file mode 100644
index 000000000000..4bf7e5a95918
--- /dev/null
+++ b/packages/models/src/readSecondaryPreferred.ts
@@ -0,0 +1,18 @@
+import type { Db, ReadPreferenceLike } from 'mongodb';
+import { ReadPreference } from 'mongodb';
+
+export function readSecondaryPreferred(db?: Db, tags: any[] = []): ReadPreferenceLike {
+ const { readPreference } = db?.options || {};
+
+ if (tags.length) {
+ return new ReadPreference(ReadPreference.SECONDARY_PREFERRED, tags);
+ }
+ if (readPreference && readPreference instanceof ReadPreference && readPreference.tags?.length) {
+ return new ReadPreference(ReadPreference.SECONDARY_PREFERRED, readPreference.tags);
+ }
+
+ // For some reason the new ReadPreference definition requires the tags parameter even not been
+ // required by the code implementation and, for some reason, when passing an empty array it
+ // doesn't ignore the tags and stop using the secondaries.
+ return ReadPreference.SECONDARY_PREFERRED;
+}
From c13c50f9a69a70e9d124b4b98cc5d0799f14eb5f Mon Sep 17 00:00:00 2001
From: Diego Sampaio
Date: Thu, 26 Dec 2024 11:09:51 -0300
Subject: [PATCH 02/14] export models from package
---
.../ee/server/lib/registerServiceModels.ts | 66 -------
apps/meteor/server/main.ts | 2 +-
apps/meteor/server/models.ts | 163 ++++++++++++++++++
packages/models/package.json | 10 +-
packages/models/src/index.ts | 72 +++++++-
packages/models/src/modelClasses.ts | 75 ++++++++
packages/models/src/models/AppsTokens.ts | 2 +-
packages/models/src/models/BaseRaw.ts | 6 +-
.../models/src/models/FederationRoomEvents.ts | 2 +-
.../models/src/models/FederationServers.ts | 2 +-
.../models/src/models/LivechatDepartment.ts | 2 +-
.../src/models/LivechatDepartmentAgents.ts | 2 +-
packages/models/src/models/LivechatRooms.ts | 4 +-
.../models/src/models/LivechatVisitors.ts | 2 +-
.../models/src/models/ModerationReports.ts | 2 +-
packages/models/src/models/Roles.ts | 2 +-
packages/models/src/models/Rooms.ts | 4 +-
packages/models/src/models/Sessions.ts | 2 +-
packages/models/src/models/Subscriptions.ts | 2 +-
packages/models/tsconfig.json | 2 +
yarn.lock | 10 +-
21 files changed, 347 insertions(+), 87 deletions(-)
delete mode 100644 apps/meteor/ee/server/lib/registerServiceModels.ts
create mode 100644 apps/meteor/server/models.ts
create mode 100644 packages/models/src/modelClasses.ts
diff --git a/apps/meteor/ee/server/lib/registerServiceModels.ts b/apps/meteor/ee/server/lib/registerServiceModels.ts
deleted file mode 100644
index 22d8a9c1b322..000000000000
--- a/apps/meteor/ee/server/lib/registerServiceModels.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-import type {
- ILivechatDepartmentAgents,
- ILivechatInquiryRecord,
- ISetting,
- ISubscription,
- RocketChatRecordDeleted,
-} from '@rocket.chat/core-typings';
-import { registerModel } from '@rocket.chat/models';
-import type { Collection, Db } from 'mongodb';
-
-import { EmailInboxRaw } from '../../../server/models/raw/EmailInbox';
-import { InstanceStatusRaw } from '../../../server/models/raw/InstanceStatus';
-import { IntegrationHistoryRaw } from '../../../server/models/raw/IntegrationHistory';
-import { IntegrationsRaw } from '../../../server/models/raw/Integrations';
-import { LivechatDepartmentAgentsRaw } from '../../../server/models/raw/LivechatDepartmentAgents';
-import { LivechatInquiryRaw } from '../../../server/models/raw/LivechatInquiry';
-import { LivechatRoomsRaw } from '../../../server/models/raw/LivechatRooms';
-import { LivechatVisitorsRaw } from '../../../server/models/raw/LivechatVisitors';
-import { LoginServiceConfigurationRaw } from '../../../server/models/raw/LoginServiceConfiguration';
-import { MessagesRaw } from '../../../server/models/raw/Messages';
-import { PbxEventsRaw } from '../../../server/models/raw/PbxEvents';
-import { PermissionsRaw } from '../../../server/models/raw/Permissions';
-import { RolesRaw } from '../../../server/models/raw/Roles';
-import { RoomsRaw } from '../../../server/models/raw/Rooms';
-import { SettingsRaw } from '../../../server/models/raw/Settings';
-import { SubscriptionsRaw } from '../../../server/models/raw/Subscriptions';
-import { TeamRaw } from '../../../server/models/raw/Team';
-import { TeamMemberRaw } from '../../../server/models/raw/TeamMember';
-import { UploadsRaw } from '../../../server/models/raw/Uploads';
-import { UsersRaw } from '../../../server/models/raw/Users';
-import { UsersSessionsRaw } from '../../../server/models/raw/UsersSessions';
-import { LivechatPriorityRaw } from '../models/raw/LivechatPriority';
-
-// TODO add trash param to appropiate model instances
-export function registerServiceModels(db: Db, trash?: Collection>): void {
- registerModel('IRolesModel', () => new RolesRaw(db));
- registerModel('IRoomsModel', () => new RoomsRaw(db));
- registerModel('ISettingsModel', () => new SettingsRaw(db, trash as Collection>));
- registerModel('ISubscriptionsModel', () => new SubscriptionsRaw(db, trash as Collection>));
- registerModel('ITeamModel', () => new TeamRaw(db));
- registerModel('ITeamMemberModel', () => new TeamMemberRaw(db));
- registerModel('IUsersModel', () => new UsersRaw(db));
-
- registerModel('IMessagesModel', () => new MessagesRaw(db));
-
- registerModel(
- 'ILivechatInquiryModel',
- () => new LivechatInquiryRaw(db, trash as Collection>),
- );
- registerModel(
- 'ILivechatDepartmentAgentsModel',
- () => new LivechatDepartmentAgentsRaw(db, trash as Collection>),
- );
- registerModel('IUsersSessionsModel', () => new UsersSessionsRaw(db));
- registerModel('IPermissionsModel', () => new PermissionsRaw(db));
- registerModel('ILoginServiceConfigurationModel', () => new LoginServiceConfigurationRaw(db));
- registerModel('IInstanceStatusModel', () => new InstanceStatusRaw(db));
- registerModel('IIntegrationHistoryModel', () => new IntegrationHistoryRaw(db));
- registerModel('IIntegrationsModel', () => new IntegrationsRaw(db));
- registerModel('IEmailInboxModel', () => new EmailInboxRaw(db));
- registerModel('IPbxEventsModel', () => new PbxEventsRaw(db));
- registerModel('ILivechatPriorityModel', new LivechatPriorityRaw(db));
- registerModel('ILivechatRoomsModel', () => new LivechatRoomsRaw(db));
- registerModel('IUploadsModel', () => new UploadsRaw(db));
- registerModel('ILivechatVisitorsModel', () => new LivechatVisitorsRaw(db));
-}
diff --git a/apps/meteor/server/main.ts b/apps/meteor/server/main.ts
index 647f476587b8..0a3b164033b9 100644
--- a/apps/meteor/server/main.ts
+++ b/apps/meteor/server/main.ts
@@ -1,5 +1,5 @@
import './tracing';
-import './models/startup';
+import './models';
/**
* ./settings uses top level await, in theory the settings creation
* and the startup should be done in parallel
diff --git a/apps/meteor/server/models.ts b/apps/meteor/server/models.ts
new file mode 100644
index 000000000000..bfb35aafbde5
--- /dev/null
+++ b/apps/meteor/server/models.ts
@@ -0,0 +1,163 @@
+import type { RocketChatRecordDeleted, ISubscription, ILivechatInquiryRecord, ILivechatDepartmentAgents } from '@rocket.chat/core-typings';
+import {
+ AnalyticsRaw,
+ AppsLogsModel,
+ AppsModel,
+ AppsPersistenceModel,
+ AppsTokensModel,
+ AvatarsRaw,
+ BannersDismissRaw,
+ BannersRaw,
+ CalendarEventRaw,
+ CredentialTokensRaw,
+ CronHistoryRaw,
+ CustomSoundsRaw,
+ CustomUserStatusRaw,
+ EmailInboxRaw,
+ EmailMessageHistoryRaw,
+ EmojiCustomRaw,
+ ExportOperationsRaw,
+ FederationKeysRaw,
+ FederationRoomEventsRaw,
+ FederationServersRaw,
+ ImportDataRaw,
+ ImportsModel,
+ InstanceStatusRaw,
+ IntegrationHistoryRaw,
+ IntegrationsRaw,
+ InvitesRaw,
+ LivechatAgentActivityRaw,
+ LivechatBusinessHoursRaw,
+ LivechatContactsRaw,
+ LivechatCustomFieldRaw,
+ LivechatDepartmentAgentsRaw,
+ LivechatDepartmentRaw,
+ LivechatInquiryRaw,
+ LivechatRoomsRaw,
+ LivechatTriggerRaw,
+ LivechatVisitorsRaw,
+ LoginServiceConfigurationRaw,
+ MatrixBridgedRoomRaw,
+ MatrixBridgedUserRaw,
+ MessageReadsRaw,
+ MessagesRaw,
+ MigrationsRaw,
+ ModerationReportsRaw,
+ NotificationQueueRaw,
+ NpsRaw,
+ NpsVoteRaw,
+ OAuthAccessTokensRaw,
+ OAuthAppsRaw,
+ OAuthAuthCodesRaw,
+ OAuthRefreshTokensRaw,
+ OEmbedCacheRaw,
+ PbxEventsRaw,
+ PermissionsRaw,
+ PushTokenRaw,
+ ReadReceiptsDummy,
+ registerModel,
+ ReportsRaw,
+ RolesRaw,
+ RoomsRaw,
+ ServerEventsRaw,
+ SessionsRaw,
+ SettingsRaw,
+ SmarshHistoryRaw,
+ StatisticsRaw,
+ SubscriptionsRaw,
+ TeamMemberRaw,
+ TeamRaw,
+ UploadsRaw,
+ UserDataFilesRaw,
+ UsersRaw,
+ UsersSessionsRaw,
+ VideoConferenceRaw,
+ VoipRoomRaw,
+ WebdavAccountsRaw,
+ WorkspaceCredentialsRaw,
+} from '@rocket.chat/models';
+import type { Collection } from 'mongodb';
+
+import { trashCollection } from './database/trash';
+import { db } from './database/utils';
+
+registerModel('IAnalyticsModel', new AnalyticsRaw(db));
+registerModel('IAppLogsModel', new AppsLogsModel(db));
+registerModel('IAppsModel', new AppsModel(db));
+registerModel('IAppsPersistenceModel', new AppsPersistenceModel(db));
+registerModel('IAppsTokensModel', new AppsTokensRaw(db));
+registerModel('IAvatarsModel', new AvatarsRaw(db));
+registerModel('IBannersDismissModel', new BannersDismissRaw(db));
+registerModel('IBannersModel', new BannersRaw(db));
+registerModel('ICalendarEventModel', new CalendarEventRaw(db));
+registerModel('ICredentialTokensModel', new CredentialTokensRaw(db));
+registerModel('ICronHistoryModel', new CronHistoryRaw(db));
+registerModel('ICustomSoundsModel', new CustomSoundsRaw(db));
+registerModel('ICustomUserStatusModel', new CustomUserStatusRaw(db));
+registerModel('IEmailInboxModel', new EmailInboxRaw(db));
+registerModel('IEmailMessageHistoryModel', new EmailMessageHistoryRaw(db));
+registerModel('IEmojiCustomModel', new EmojiCustomRaw(db, trashCollection));
+registerModel('IExportOperationsModel', new ExportOperationsRaw(db));
+registerModel('IFederationKeysModel', new FederationKeysRaw(db));
+registerModel('IFederationRoomEventsModel', new FederationRoomEventsRaw(db));
+registerModel('IFederationServersModel', new FederationServersRaw(db));
+registerModel('IImportDataModel', new ImportDataRaw(db));
+registerModel('IImportsModel', new ImportsModel(db));
+registerModel('IInstanceStatusModel', new InstanceStatusRaw(db));
+registerModel('IIntegrationHistoryModel', new IntegrationHistoryRaw(db));
+registerModel('IIntegrationsModel', new IntegrationsRaw(db));
+registerModel('IInvitesModel', new InvitesRaw(db));
+registerModel('ILivechatAgentActivityModel', new LivechatAgentActivityRaw(db));
+registerModel('ILivechatBusinessHoursModel', new LivechatBusinessHoursRaw(db));
+registerModel('ILivechatContactsModel', new LivechatContactsRaw(db));
+registerModel('ILivechatCustomFieldModel', new LivechatCustomFieldRaw(db));
+registerModel(
+ 'ILivechatDepartmentAgentsModel',
+ new LivechatDepartmentAgentsRaw(db, trashCollection as Collection>),
+);
+registerModel('ILivechatDepartmentModel', new LivechatDepartmentRaw(db, trashCollection));
+registerModel(
+ 'ILivechatInquiryModel',
+ new LivechatInquiryRaw(db, trashCollection as Collection>),
+);
+registerModel('ILivechatRoomsModel', new LivechatRoomsRaw(db, trashCollection));
+registerModel('ILivechatTriggerModel', new LivechatTriggerRaw(db));
+registerModel('ILivechatVisitorsModel', new LivechatVisitorsRaw(db));
+registerModel('ILoginServiceConfigurationModel', new LoginServiceConfigurationRaw(db));
+registerModel('IMatrixBridgedRoomModel', new MatrixBridgedRoomRaw(db));
+registerModel('IMatrixBridgedUserModel', new MatrixBridgedUserRaw(db));
+registerModel('IMessageReadsModel', new MessageReadsRaw(db));
+registerModel('IMessagesModel', new MessagesRaw(db, trashCollection));
+registerModel('IMigrationsModel', new MigrationsRaw(db));
+registerModel('IModerationReportsModel', new ModerationReportsRaw(db));
+registerModel('INotificationQueueModel', new NotificationQueueRaw(db));
+registerModel('INpsModel', new NpsRaw(db));
+registerModel('INpsVoteModel', new NpsVoteRaw(db));
+registerModel('IOAuthAccessTokensModel', new OAuthAccessTokensRaw(db));
+registerModel('IOAuthAppsModel', new OAuthAppsRaw(db));
+registerModel('IOAuthAuthCodesModel', new OAuthAuthCodesRaw(db));
+registerModel('IOAuthRefreshTokensModel', new OAuthRefreshTokensRaw(db));
+registerModel('IOEmbedCacheModel', new OEmbedCacheRaw(db));
+registerModel('IPbxEventsModel', new PbxEventsRaw(db));
+registerModel('IPermissionsModel', new PermissionsRaw(db, trashCollection));
+registerModel('IPushTokenModel', new PushTokenRaw(db));
+registerModel('IReadReceiptsModel', new ReadReceiptsDummy(), false);
+registerModel('IReportsModel', new ReportsRaw(db));
+registerModel('IRolesModel', new RolesRaw(db, trashCollection));
+registerModel('IRoomsModel', new RoomsRaw(db, trashCollection));
+registerModel('IServerEventsModel', new ServerEventsRaw(db));
+registerModel('ISessionsModel', new SessionsRaw(db));
+registerModel('ISettingsModel', new SettingsRaw(db, trashCollection));
+registerModel('ISmarshHistoryModel', new SmarshHistoryRaw(db));
+registerModel('IStatisticsModel', new StatisticsRaw(db));
+registerModel('ISubscriptionsModel', new SubscriptionsRaw(db, trashCollection as Collection>));
+registerModel('ITeamMemberModel', new TeamMemberRaw(db));
+registerModel('ITeamModel', new TeamRaw(db));
+registerModel('IUploadsModel', new UploadsRaw(db));
+registerModel('IUserDataFilesModel', new UserDataFilesRaw(db));
+registerModel('IUsersModel', new UsersRaw(db, trashCollection));
+registerModel('IUsersSessionsModel', new UsersSessionsRaw(db));
+registerModel('IVideoConferenceModel', new VideoConferenceRaw(db));
+registerModel('IVoipRoomModel', new VoipRoomRaw(db, trashCollection));
+registerModel('IWebdavAccountsModel', new WebdavAccountsRaw(db));
+registerModel('IWorkspaceCredentialsModel', new WorkspaceCredentialsRaw(db));
diff --git a/packages/models/package.json b/packages/models/package.json
index 2259a4d1566c..ee978f14ea2d 100644
--- a/packages/models/package.json
+++ b/packages/models/package.json
@@ -5,12 +5,20 @@
"devDependencies": {
"@rocket.chat/jest-presets": "workspace:~",
"@types/jest": "~29.5.14",
+ "@types/node-rsa": "^1.1.4",
"eslint": "~8.45.0",
"jest": "^29.7.0",
"typescript": "~5.7.2"
},
"dependencies": {
- "@rocket.chat/model-typings": "workspace:~"
+ "@rocket.chat/model-typings": "workspace:~",
+ "@rocket.chat/random": "workspace:^",
+ "@rocket.chat/rest-typings": "workspace:^",
+ "@rocket.chat/sha256": "workspace:^",
+ "@rocket.chat/string-helpers": "^0.31.25",
+ "@rocket.chat/tracing": "workspace:^",
+ "moment": "^2.30.1",
+ "node-rsa": "^1.1.1"
},
"scripts": {
"build": "rm -rf dist && tsc",
diff --git a/packages/models/src/index.ts b/packages/models/src/index.ts
index 7f13e4c9a079..cacd251c3588 100644
--- a/packages/models/src/index.ts
+++ b/packages/models/src/index.ts
@@ -1,3 +1,10 @@
+import type {
+ ILivechatDepartmentAgents,
+ ILivechatInquiryRecord,
+ ISetting,
+ ISubscription,
+ RocketChatRecordDeleted,
+} from '@rocket.chat/core-typings';
import type {
IAnalyticsModel,
IAvatarsModel,
@@ -83,14 +90,42 @@ import type {
IModerationReportsModel,
IWorkspaceCredentialsModel,
} from '@rocket.chat/model-typings';
+import type { Collection, Db } from 'mongodb';
-import { proxify } from './proxify';
+import {
+ TeamMemberRaw,
+ MessagesRaw,
+ LivechatInquiryRaw,
+ LivechatDepartmentAgentsRaw,
+ PermissionsRaw,
+ LoginServiceConfigurationRaw,
+ InstanceStatusRaw,
+ IntegrationHistoryRaw,
+ IntegrationsRaw,
+ EmailInboxRaw,
+ PbxEventsRaw,
+ LivechatRoomsRaw,
+ UploadsRaw,
+ LivechatVisitorsRaw,
+ RolesRaw,
+ RoomsRaw,
+ SettingsRaw,
+ SubscriptionsRaw,
+ TeamRaw,
+ UsersRaw,
+ UsersSessionsRaw,
+} from './modelClasses';
+import { proxify, registerModel } from './proxify';
const prefix = 'rocketchat_';
export function getCollectionName(name: string): string {
return `${prefix}${name}`;
}
+export * from './modelClasses';
+
+// export * from './dummy/ReadReceipts';
+
export { registerModel } from './proxify';
export { type Updater, UpdaterImpl } from './updater';
@@ -179,3 +214,38 @@ export const CronHistory = proxify('ICronHistoryModel');
export const Migrations = proxify('IMigrationsModel');
export const ModerationReports = proxify('IModerationReportsModel');
export const WorkspaceCredentials = proxify('IWorkspaceCredentialsModel');
+
+export function registerServiceModels(db: Db, trash?: Collection>): void {
+ registerModel('ISettingsModel', () => new SettingsRaw(db, trash as Collection>));
+ registerModel('IUsersSessionsModel', () => new UsersSessionsRaw(db));
+ registerModel('IUsersModel', () => new UsersRaw(db));
+
+ registerModel('IRolesModel', () => new RolesRaw(db));
+ registerModel('IRoomsModel', () => new RoomsRaw(db));
+ registerModel('ISubscriptionsModel', () => new SubscriptionsRaw(db, trash as Collection>));
+ registerModel('ITeamModel', () => new TeamRaw(db));
+ registerModel('ITeamMemberModel', () => new TeamMemberRaw(db));
+
+ registerModel('IMessagesModel', () => new MessagesRaw(db));
+
+ registerModel(
+ 'ILivechatInquiryModel',
+ () => new LivechatInquiryRaw(db, trash as Collection>),
+ );
+ registerModel(
+ 'ILivechatDepartmentAgentsModel',
+ () => new LivechatDepartmentAgentsRaw(db, trash as Collection>),
+ );
+
+ registerModel('IPermissionsModel', () => new PermissionsRaw(db));
+ registerModel('ILoginServiceConfigurationModel', () => new LoginServiceConfigurationRaw(db));
+ registerModel('IInstanceStatusModel', () => new InstanceStatusRaw(db));
+ registerModel('IIntegrationHistoryModel', () => new IntegrationHistoryRaw(db));
+ registerModel('IIntegrationsModel', () => new IntegrationsRaw(db));
+ registerModel('IEmailInboxModel', () => new EmailInboxRaw(db));
+ registerModel('IPbxEventsModel', () => new PbxEventsRaw(db));
+ // registerModel('ILivechatPriorityModel', new LivechatPriorityRaw(db));
+ registerModel('ILivechatRoomsModel', () => new LivechatRoomsRaw(db));
+ registerModel('IUploadsModel', () => new UploadsRaw(db));
+ registerModel('ILivechatVisitorsModel', () => new LivechatVisitorsRaw(db));
+}
diff --git a/packages/models/src/modelClasses.ts b/packages/models/src/modelClasses.ts
new file mode 100644
index 000000000000..9bf8582fe213
--- /dev/null
+++ b/packages/models/src/modelClasses.ts
@@ -0,0 +1,75 @@
+export * from './models/BaseRaw';
+export * from './models/Analytics';
+export * from './models/Apps';
+export * from './models/AppsPersistence';
+export * from './models/AppsTokens';
+export * from './models/AppLogsModel';
+export * from './models/Avatars';
+export * from './models/Banners';
+export * from './models/BannersDismiss';
+export * from './models/CalendarEvent';
+export * from './models/CustomSounds';
+export * from './models/CustomUserStatus';
+export * from './models/EmailInbox';
+export * from './models/EmailMessageHistory';
+export * from './models/EmojiCustom';
+export * from './models/ExportOperations';
+export * from './models/FederationKeys';
+export * from './models/FederationRoomEvents';
+export * from './models/FederationServers';
+export * from './models/ImportData';
+export * from './models/Imports';
+export * from './models/InstanceStatus';
+export * from './models/IntegrationHistory';
+export * from './models/Integrations';
+export * from './models/Invites';
+export * from './models/LivechatAgentActivity';
+export * from './models/LivechatBusinessHours';
+export * from './models/LivechatContacts';
+export * from './models/LivechatCustomField';
+export * from './models/LivechatDepartment';
+export * from './models/LivechatDepartmentAgents';
+export * from './models/LivechatInquiry';
+export * from './models/LivechatRooms';
+export * from './models/LivechatTrigger';
+export * from './models/LivechatVisitors';
+export * from './models/LoginServiceConfiguration';
+export * from './models/Messages';
+export * from './models/NotificationQueue';
+export * from './models/Nps';
+export * from './models/NpsVote';
+export * from './models/OAuthAccessTokens';
+export * from './models/OAuthApps';
+export * from './models/OAuthAuthCodes';
+export * from './models/OAuthRefreshTokens';
+export * from './models/OEmbedCache';
+export * from './models/PbxEvents';
+export * from './models/Permissions';
+export * from './models/PushToken';
+export * from './models/Reports';
+export * from './models/Roles';
+export * from './models/Rooms';
+export * from './models/ServerEvents';
+export * from './models/Sessions';
+export * from './models/Settings';
+export * from './models/SmarshHistory';
+export * from './models/Statistics';
+export * from './models/Subscriptions';
+export * from './models/Team';
+export * from './models/TeamMember';
+export * from './models/Uploads';
+export * from './models/UserDataFiles';
+export * from './models/Users';
+export * from './models/UsersSessions';
+export * from './models/VideoConference';
+export * from './models/VoipRoom';
+export * from './models/WebdavAccounts';
+export * from './models/MatrixBridgedRoom';
+export * from './models/MatrixBridgedUser';
+export * from './models/CredentialTokens';
+export * from './models/MessageReads';
+export * from './models/CronHistoryModel';
+export * from './models/Migrations';
+export * from './models/ModerationReports';
+export * from './models/WorkspaceCredentials';
+export * from './models/Trash';
diff --git a/packages/models/src/models/AppsTokens.ts b/packages/models/src/models/AppsTokens.ts
index 43c085f30226..b151b3de6310 100644
--- a/packages/models/src/models/AppsTokens.ts
+++ b/packages/models/src/models/AppsTokens.ts
@@ -4,7 +4,7 @@ import type { Db } from 'mongodb';
import { BaseRaw } from './BaseRaw';
-export class AppsTokens extends BaseRaw implements IAppsTokensModel {
+export class AppsTokensRaw extends BaseRaw implements IAppsTokensModel {
constructor(db: Db) {
super(db, '_raix_push_app_tokens', undefined, { collectionNameResolver: (name) => name });
}
diff --git a/packages/models/src/models/BaseRaw.ts b/packages/models/src/models/BaseRaw.ts
index 7b79973ba14f..b1d8eb352a1c 100644
--- a/packages/models/src/models/BaseRaw.ts
+++ b/packages/models/src/models/BaseRaw.ts
@@ -1,7 +1,5 @@
import type { RocketChatRecordDeleted } from '@rocket.chat/core-typings';
import type { IBaseModel, DefaultFields, ResultFields, FindPaginated, InsertionModel } from '@rocket.chat/model-typings';
-import type { Updater } from '@rocket.chat/models';
-import { getCollectionName, UpdaterImpl } from '@rocket.chat/models';
import { traceInstanceMethods } from '@rocket.chat/tracing';
import { ObjectId } from 'mongodb';
import type {
@@ -31,6 +29,8 @@ import type {
CountDocumentsOptions,
} from 'mongodb';
+import { getCollectionName, UpdaterImpl } from '..';
+import type { Updater } from '../updater';
import { setUpdatedAt } from './setUpdatedAt';
const warnFields =
@@ -53,7 +53,7 @@ export abstract class BaseRaw<
TDeleted extends RocketChatRecordDeleted = RocketChatRecordDeleted,
> implements IBaseModel
{
- public readonly defaultFields: C;
+ public readonly defaultFields: C | undefined;
public readonly col: Collection;
diff --git a/packages/models/src/models/FederationRoomEvents.ts b/packages/models/src/models/FederationRoomEvents.ts
index df69c42e056e..e15b47d581a5 100644
--- a/packages/models/src/models/FederationRoomEvents.ts
+++ b/packages/models/src/models/FederationRoomEvents.ts
@@ -5,7 +5,7 @@ import type { Db, DeleteResult, IndexDescription } from 'mongodb';
import { FederationEventsModel } from './FederationEvents';
-export class FederationRoomEvents extends FederationEventsModel implements IFederationRoomEventsModel {
+export class FederationRoomEventsRaw extends FederationEventsModel implements IFederationRoomEventsModel {
constructor(db: Db) {
super(db, 'federation_room_events');
}
diff --git a/packages/models/src/models/FederationServers.ts b/packages/models/src/models/FederationServers.ts
index af94f26cf76e..95256c2280b9 100644
--- a/packages/models/src/models/FederationServers.ts
+++ b/packages/models/src/models/FederationServers.ts
@@ -1,9 +1,9 @@
import type { IFederationServer, RocketChatRecordDeleted } from '@rocket.chat/core-typings';
import type { IFederationServersModel } from '@rocket.chat/model-typings';
-import { Users } from '@rocket.chat/models';
import type { Collection, Db, IndexDescription, UpdateResult } from 'mongodb';
import { BaseRaw } from './BaseRaw';
+import { Users } from '../index';
export class FederationServersRaw extends BaseRaw implements IFederationServersModel {
constructor(db: Db, trash?: Collection>) {
diff --git a/packages/models/src/models/LivechatDepartment.ts b/packages/models/src/models/LivechatDepartment.ts
index 949807f7213e..b77f752c6e0e 100644
--- a/packages/models/src/models/LivechatDepartment.ts
+++ b/packages/models/src/models/LivechatDepartment.ts
@@ -1,6 +1,5 @@
import type { ILivechatDepartment, RocketChatRecordDeleted } from '@rocket.chat/core-typings';
import type { ILivechatDepartmentModel } from '@rocket.chat/model-typings';
-import { LivechatDepartmentAgents, LivechatUnitMonitors } from '@rocket.chat/models';
import { escapeRegExp } from '@rocket.chat/string-helpers';
import type {
Collection,
@@ -16,6 +15,7 @@ import type {
AggregationCursor,
} from 'mongodb';
+import { LivechatDepartmentAgents, LivechatUnitMonitors } from '../index';
import { BaseRaw } from './BaseRaw';
export class LivechatDepartmentRaw extends BaseRaw implements ILivechatDepartmentModel {
diff --git a/packages/models/src/models/LivechatDepartmentAgents.ts b/packages/models/src/models/LivechatDepartmentAgents.ts
index 6d7ec76222db..62e9db5bc265 100644
--- a/packages/models/src/models/LivechatDepartmentAgents.ts
+++ b/packages/models/src/models/LivechatDepartmentAgents.ts
@@ -1,6 +1,5 @@
import type { ILivechatDepartmentAgents, RocketChatRecordDeleted, IUser } from '@rocket.chat/core-typings';
import type { FindPaginated, ILivechatDepartmentAgentsModel } from '@rocket.chat/model-typings';
-import { Users } from '@rocket.chat/models';
import type {
Collection,
FindCursor,
@@ -15,6 +14,7 @@ import type {
AggregationCursor,
} from 'mongodb';
+import { Users } from '../index';
import { BaseRaw } from './BaseRaw';
export class LivechatDepartmentAgentsRaw extends BaseRaw implements ILivechatDepartmentAgentsModel {
diff --git a/packages/models/src/models/LivechatRooms.ts b/packages/models/src/models/LivechatRooms.ts
index b4a4e89eb7ae..6e03b422cc78 100644
--- a/packages/models/src/models/LivechatRooms.ts
+++ b/packages/models/src/models/LivechatRooms.ts
@@ -14,8 +14,6 @@ import type {
} from '@rocket.chat/core-typings';
import { UserStatus } from '@rocket.chat/core-typings';
import type { FindPaginated, ILivechatRoomsModel } from '@rocket.chat/model-typings';
-import type { Updater } from '@rocket.chat/models';
-import { Settings } from '@rocket.chat/models';
import { escapeRegExp } from '@rocket.chat/string-helpers';
import type {
Db,
@@ -32,6 +30,8 @@ import type {
UpdateOptions,
} from 'mongodb';
+import { Settings } from '../index';
+import type { Updater } from '../updater';
import { BaseRaw } from './BaseRaw';
import { readSecondaryPreferred } from '../readSecondaryPreferred';
diff --git a/packages/models/src/models/LivechatVisitors.ts b/packages/models/src/models/LivechatVisitors.ts
index 27e46808bea9..d6d9f45ef778 100644
--- a/packages/models/src/models/LivechatVisitors.ts
+++ b/packages/models/src/models/LivechatVisitors.ts
@@ -1,6 +1,5 @@
import type { ILivechatVisitor, RocketChatRecordDeleted } from '@rocket.chat/core-typings';
import type { FindPaginated, ILivechatVisitorsModel } from '@rocket.chat/model-typings';
-import { Settings } from '@rocket.chat/models';
import { escapeRegExp } from '@rocket.chat/string-helpers';
import type {
AggregationCursor,
@@ -19,6 +18,7 @@ import type {
} from 'mongodb';
import { ObjectId } from 'mongodb';
+import { Settings } from '../index';
import { BaseRaw } from './BaseRaw';
export class LivechatVisitorsRaw extends BaseRaw implements ILivechatVisitorsModel {
diff --git a/packages/models/src/models/ModerationReports.ts b/packages/models/src/models/ModerationReports.ts
index b50057a389fd..c57a8126d1e0 100644
--- a/packages/models/src/models/ModerationReports.ts
+++ b/packages/models/src/models/ModerationReports.ts
@@ -10,7 +10,7 @@ import type { FindPaginated, IModerationReportsModel, PaginationParams } from '@
import type { AggregationCursor, Collection, Db, Document, FindCursor, FindOptions, IndexDescription, UpdateResult } from 'mongodb';
import { BaseRaw } from './BaseRaw';
-import { readSecondaryPreferred } from '../../database/readSecondaryPreferred';
+import { readSecondaryPreferred } from '../readSecondaryPreferred';
export class ModerationReportsRaw extends BaseRaw implements IModerationReportsModel {
constructor(db: Db, trash?: Collection>) {
diff --git a/packages/models/src/models/Roles.ts b/packages/models/src/models/Roles.ts
index fad0312bc52f..d731cf54fe72 100644
--- a/packages/models/src/models/Roles.ts
+++ b/packages/models/src/models/Roles.ts
@@ -1,8 +1,8 @@
import type { IRole, IRoom, IUser, RocketChatRecordDeleted } from '@rocket.chat/core-typings';
import type { IRolesModel } from '@rocket.chat/model-typings';
-import { Subscriptions, Users } from '@rocket.chat/models';
import type { Collection, FindCursor, Db, Filter, FindOptions, Document, CountDocumentsOptions } from 'mongodb';
+import { Subscriptions, Users } from '../index';
import { BaseRaw } from './BaseRaw';
export class RolesRaw extends BaseRaw implements IRolesModel {
diff --git a/packages/models/src/models/Rooms.ts b/packages/models/src/models/Rooms.ts
index 137078b6fe87..b010f58e2e23 100644
--- a/packages/models/src/models/Rooms.ts
+++ b/packages/models/src/models/Rooms.ts
@@ -9,8 +9,6 @@ import type {
RocketChatRecordDeleted,
} from '@rocket.chat/core-typings';
import type { FindPaginated, IRoomsModel, IChannelsWithNumberOfMessagesBetweenDate } from '@rocket.chat/model-typings';
-import { Subscriptions } from '@rocket.chat/models';
-import type { Updater } from '@rocket.chat/models';
import { escapeRegExp } from '@rocket.chat/string-helpers';
import type {
AggregationCursor,
@@ -29,8 +27,10 @@ import type {
CountDocumentsOptions,
} from 'mongodb';
+import { Subscriptions } from '../index';
import { BaseRaw } from './BaseRaw';
import { readSecondaryPreferred } from '../readSecondaryPreferred';
+import type { Updater } from '../updater';
export class RoomsRaw extends BaseRaw implements IRoomsModel {
constructor(db: Db, trash?: Collection>) {
diff --git a/packages/models/src/models/Sessions.ts b/packages/models/src/models/Sessions.ts
index 954818211a5c..c89ca9d34037 100644
--- a/packages/models/src/models/Sessions.ts
+++ b/packages/models/src/models/Sessions.ts
@@ -12,7 +12,6 @@ import type {
RocketChatRecordDeleted,
} from '@rocket.chat/core-typings';
import type { ISessionsModel } from '@rocket.chat/model-typings';
-import { getCollectionName } from '@rocket.chat/models';
import type { PaginatedResult, WithItemCount } from '@rocket.chat/rest-typings';
import type {
AggregationCursor,
@@ -28,6 +27,7 @@ import type {
OptionalId,
} from 'mongodb';
+import { getCollectionName } from '../index';
import { BaseRaw } from './BaseRaw';
import { readSecondaryPreferred } from '../readSecondaryPreferred';
diff --git a/packages/models/src/models/Subscriptions.ts b/packages/models/src/models/Subscriptions.ts
index 2ba63aba86cf..ba28b6da843a 100644
--- a/packages/models/src/models/Subscriptions.ts
+++ b/packages/models/src/models/Subscriptions.ts
@@ -9,7 +9,6 @@ import type {
SpotlightUser,
} from '@rocket.chat/core-typings';
import type { ISubscriptionsModel } from '@rocket.chat/model-typings';
-import { Rooms, Users } from '@rocket.chat/models';
import { escapeRegExp } from '@rocket.chat/string-helpers';
import { compact } from 'lodash';
import mem from 'mem';
@@ -33,6 +32,7 @@ import type {
ModifyResult,
} from 'mongodb';
+import { Rooms, Users } from '../index';
import { BaseRaw } from './BaseRaw';
export class SubscriptionsRaw extends BaseRaw implements ISubscriptionsModel {
diff --git a/packages/models/tsconfig.json b/packages/models/tsconfig.json
index 74d65c3b8a3d..e28418fe4a24 100644
--- a/packages/models/tsconfig.json
+++ b/packages/models/tsconfig.json
@@ -1,6 +1,8 @@
{
"extends": "../../tsconfig.base.server.json",
"compilerOptions": {
+ // TODO migrate Users to TS
+ "allowJs": true,
"declaration": true,
"rootDir": "./src",
"outDir": "./dist",
diff --git a/yarn.lock b/yarn.lock
index 835f25921016..3f7587292153 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -9557,9 +9557,17 @@ __metadata:
dependencies:
"@rocket.chat/jest-presets": "workspace:~"
"@rocket.chat/model-typings": "workspace:~"
+ "@rocket.chat/random": "workspace:^"
+ "@rocket.chat/rest-typings": "workspace:^"
+ "@rocket.chat/sha256": "workspace:^"
+ "@rocket.chat/string-helpers": "npm:^0.31.25"
+ "@rocket.chat/tracing": "workspace:^"
"@types/jest": "npm:~29.5.14"
+ "@types/node-rsa": "npm:^1.1.4"
eslint: "npm:~8.45.0"
jest: "npm:^29.7.0"
+ moment: "npm:^2.30.1"
+ node-rsa: "npm:^1.1.1"
typescript: "npm:~5.7.2"
languageName: unknown
linkType: soft
@@ -10014,7 +10022,7 @@ __metadata:
languageName: unknown
linkType: soft
-"@rocket.chat/string-helpers@npm:~0.31.25":
+"@rocket.chat/string-helpers@npm:^0.31.25, @rocket.chat/string-helpers@npm:~0.31.25":
version: 0.31.25
resolution: "@rocket.chat/string-helpers@npm:0.31.25"
checksum: 10/9fd3f25a9e87a6c33bea1fb521c51e7e6497ad5f9b695807b8b0b98b3130799924305adaa1ea851f10ed2ffc64af8270f3f14339ac181f64b038cb1fd8f8819f
From e31b874a91d28ab2c026e0ae793efb652d4c7e18 Mon Sep 17 00:00:00 2001
From: Diego Sampaio
Date: Thu, 26 Dec 2024 11:17:48 -0300
Subject: [PATCH 03/14] fix services build
---
_templates/service/new/service.ejs.t | 3 +--
ee/apps/account-service/Dockerfile | 6 ++++++
ee/apps/account-service/src/service.ts | 3 +--
ee/apps/authorization-service/src/service.ts | 3 +--
ee/apps/ddp-streamer/Dockerfile | 6 ++++++
ee/apps/ddp-streamer/src/service.ts | 3 +--
ee/apps/omnichannel-transcript/Dockerfile | 6 ++++++
ee/apps/omnichannel-transcript/src/service.ts | 3 +--
ee/apps/presence-service/Dockerfile | 6 ++++++
ee/apps/presence-service/src/service.ts | 3 +--
ee/apps/queue-worker/Dockerfile | 6 ++++++
ee/apps/queue-worker/src/service.ts | 3 +--
ee/apps/stream-hub-service/Dockerfile | 6 ++++++
ee/apps/stream-hub-service/src/service.ts | 2 +-
14 files changed, 44 insertions(+), 15 deletions(-)
diff --git a/_templates/service/new/service.ejs.t b/_templates/service/new/service.ejs.t
index bdd160b43cdf..b0880bd47539 100644
--- a/_templates/service/new/service.ejs.t
+++ b/_templates/service/new/service.ejs.t
@@ -2,12 +2,11 @@
to: ee/apps/<%= name %>/src/service.ts
---
import { api, getConnection, getTrashCollection } from '@rocket.chat/core-services';
+import { registerServiceModels } from '@rocket.chat/models';
import { broker } from '@rocket.chat/network-broker';
import { startTracing } from '@rocket.chat/tracing';
import polka from 'polka';
-import { registerServiceModels } from '../../../../apps/meteor/ee/server/lib/registerServiceModels';
-
const PORT = process.env.PORT || <%= h.random() %>;
(async () => {
diff --git a/ee/apps/account-service/Dockerfile b/ee/apps/account-service/Dockerfile
index 272a781ce5b0..4adc86ff1bc9 100644
--- a/ee/apps/account-service/Dockerfile
+++ b/ee/apps/account-service/Dockerfile
@@ -47,6 +47,12 @@ COPY ./ee/packages/network-broker/dist ee/packages/network-broker/dist
COPY ./ee/packages/license/package.json packages/license/package.json
COPY ./ee/packages/license/dist packages/license/dist
+COPY ./packages/random/package.json packages/random/package.json
+COPY ./packages/random/dist packages/random/dist
+
+COPY ./packages/sha256/package.json packages/sha256/package.json
+COPY ./packages/sha256/dist packages/sha256/dist
+
COPY ./packages/tracing/package.json packages/tracing/package.json
COPY ./packages/tracing/dist packages/tracing/dist
diff --git a/ee/apps/account-service/src/service.ts b/ee/apps/account-service/src/service.ts
index e9e8cd8bef83..54ecd217091d 100755
--- a/ee/apps/account-service/src/service.ts
+++ b/ee/apps/account-service/src/service.ts
@@ -1,10 +1,9 @@
import { api, getConnection, getTrashCollection } from '@rocket.chat/core-services';
+import { registerServiceModels } from '@rocket.chat/models';
import { broker } from '@rocket.chat/network-broker';
import { startTracing } from '@rocket.chat/tracing';
import polka from 'polka';
-import { registerServiceModels } from '../../../../apps/meteor/ee/server/lib/registerServiceModels';
-
const PORT = process.env.PORT || 3033;
(async () => {
diff --git a/ee/apps/authorization-service/src/service.ts b/ee/apps/authorization-service/src/service.ts
index 8b3350c5f754..0ed1e83177a1 100755
--- a/ee/apps/authorization-service/src/service.ts
+++ b/ee/apps/authorization-service/src/service.ts
@@ -1,10 +1,9 @@
import { api, getConnection, getTrashCollection } from '@rocket.chat/core-services';
+import { registerServiceModels } from '@rocket.chat/models';
import { broker } from '@rocket.chat/network-broker';
import { startTracing } from '@rocket.chat/tracing';
import polka from 'polka';
-import { registerServiceModels } from '../../../../apps/meteor/ee/server/lib/registerServiceModels';
-
const PORT = process.env.PORT || 3034;
(async () => {
diff --git a/ee/apps/ddp-streamer/Dockerfile b/ee/apps/ddp-streamer/Dockerfile
index e0ff3620e17d..411d25ff7c3c 100644
--- a/ee/apps/ddp-streamer/Dockerfile
+++ b/ee/apps/ddp-streamer/Dockerfile
@@ -50,6 +50,12 @@ COPY ./ee/packages/network-broker/dist ee/packages/network-broker/dist
COPY ./ee/packages/license/package.json packages/license/package.json
COPY ./ee/packages/license/dist packages/license/dist
+COPY ./packages/random/package.json packages/random/package.json
+COPY ./packages/random/dist packages/random/dist
+
+COPY ./packages/sha256/package.json packages/sha256/package.json
+COPY ./packages/sha256/dist packages/sha256/dist
+
COPY ./packages/instance-status/package.json packages/instance-status/package.json
COPY ./packages/instance-status/dist packages/instance-status/dist
diff --git a/ee/apps/ddp-streamer/src/service.ts b/ee/apps/ddp-streamer/src/service.ts
index 66ad72be4050..0afea31dc231 100755
--- a/ee/apps/ddp-streamer/src/service.ts
+++ b/ee/apps/ddp-streamer/src/service.ts
@@ -1,9 +1,8 @@
import { api, getConnection, getTrashCollection } from '@rocket.chat/core-services';
+import { registerServiceModels } from '@rocket.chat/models';
import { broker } from '@rocket.chat/network-broker';
import { startTracing } from '@rocket.chat/tracing';
-import { registerServiceModels } from '../../../../apps/meteor/ee/server/lib/registerServiceModels';
-
(async () => {
const { db, client } = await getConnection();
diff --git a/ee/apps/omnichannel-transcript/Dockerfile b/ee/apps/omnichannel-transcript/Dockerfile
index daf27317e554..eb709d2f3ed0 100644
--- a/ee/apps/omnichannel-transcript/Dockerfile
+++ b/ee/apps/omnichannel-transcript/Dockerfile
@@ -47,6 +47,12 @@ COPY ./ee/packages/network-broker/dist ee/packages/network-broker/dist
COPY ./ee/packages/license/package.json packages/license/package.json
COPY ./ee/packages/license/dist packages/license/dist
+COPY ./packages/random/package.json packages/random/package.json
+COPY ./packages/random/dist packages/random/dist
+
+COPY ./packages/sha256/package.json packages/sha256/package.json
+COPY ./packages/sha256/dist packages/sha256/dist
+
COPY ./ee/packages/omnichannel-services/package.json ee/packages/omnichannel-services/package.json
COPY ./ee/packages/omnichannel-services/dist ee/packages/omnichannel-services/dist
diff --git a/ee/apps/omnichannel-transcript/src/service.ts b/ee/apps/omnichannel-transcript/src/service.ts
index e78d646bf9ea..840da856b6d7 100644
--- a/ee/apps/omnichannel-transcript/src/service.ts
+++ b/ee/apps/omnichannel-transcript/src/service.ts
@@ -1,11 +1,10 @@
import { api, getConnection, getTrashCollection } from '@rocket.chat/core-services';
import { Logger } from '@rocket.chat/logger';
+import { registerServiceModels } from '@rocket.chat/models';
import { broker } from '@rocket.chat/network-broker';
import { startTracing } from '@rocket.chat/tracing';
import polka from 'polka';
-import { registerServiceModels } from '../../../../apps/meteor/ee/server/lib/registerServiceModels';
-
const PORT = process.env.PORT || 3036;
(async () => {
diff --git a/ee/apps/presence-service/Dockerfile b/ee/apps/presence-service/Dockerfile
index cf7bc5577700..f32a2a636064 100644
--- a/ee/apps/presence-service/Dockerfile
+++ b/ee/apps/presence-service/Dockerfile
@@ -50,6 +50,12 @@ COPY ./ee/packages/network-broker/dist ee/packages/network-broker/dist
COPY ./ee/packages/license/package.json packages/license/package.json
COPY ./ee/packages/license/dist packages/license/dist
+COPY ./packages/random/package.json packages/random/package.json
+COPY ./packages/random/dist packages/random/dist
+
+COPY ./packages/sha256/package.json packages/sha256/package.json
+COPY ./packages/sha256/dist packages/sha256/dist
+
COPY ./packages/tracing/package.json packages/tracing/package.json
COPY ./packages/tracing/dist packages/tracing/dist
diff --git a/ee/apps/presence-service/src/service.ts b/ee/apps/presence-service/src/service.ts
index f1e86419fc69..e87d659dac25 100755
--- a/ee/apps/presence-service/src/service.ts
+++ b/ee/apps/presence-service/src/service.ts
@@ -1,10 +1,9 @@
import { api, getConnection, getTrashCollection } from '@rocket.chat/core-services';
+import { registerServiceModels } from '@rocket.chat/models';
import { broker } from '@rocket.chat/network-broker';
import { startTracing } from '@rocket.chat/tracing';
import polka from 'polka';
-import { registerServiceModels } from '../../../../apps/meteor/ee/server/lib/registerServiceModels';
-
const PORT = process.env.PORT || 3031;
(async () => {
diff --git a/ee/apps/queue-worker/Dockerfile b/ee/apps/queue-worker/Dockerfile
index daf27317e554..eb709d2f3ed0 100644
--- a/ee/apps/queue-worker/Dockerfile
+++ b/ee/apps/queue-worker/Dockerfile
@@ -47,6 +47,12 @@ COPY ./ee/packages/network-broker/dist ee/packages/network-broker/dist
COPY ./ee/packages/license/package.json packages/license/package.json
COPY ./ee/packages/license/dist packages/license/dist
+COPY ./packages/random/package.json packages/random/package.json
+COPY ./packages/random/dist packages/random/dist
+
+COPY ./packages/sha256/package.json packages/sha256/package.json
+COPY ./packages/sha256/dist packages/sha256/dist
+
COPY ./ee/packages/omnichannel-services/package.json ee/packages/omnichannel-services/package.json
COPY ./ee/packages/omnichannel-services/dist ee/packages/omnichannel-services/dist
diff --git a/ee/apps/queue-worker/src/service.ts b/ee/apps/queue-worker/src/service.ts
index e936621e3389..69817f42a323 100644
--- a/ee/apps/queue-worker/src/service.ts
+++ b/ee/apps/queue-worker/src/service.ts
@@ -1,11 +1,10 @@
import { api, getConnection, getTrashCollection } from '@rocket.chat/core-services';
import { Logger } from '@rocket.chat/logger';
+import { registerServiceModels } from '@rocket.chat/models';
import { broker } from '@rocket.chat/network-broker';
import { startTracing } from '@rocket.chat/tracing';
import polka from 'polka';
-import { registerServiceModels } from '../../../../apps/meteor/ee/server/lib/registerServiceModels';
-
const PORT = process.env.PORT || 3038;
(async () => {
diff --git a/ee/apps/stream-hub-service/Dockerfile b/ee/apps/stream-hub-service/Dockerfile
index de7b41913a20..18ad2653a631 100644
--- a/ee/apps/stream-hub-service/Dockerfile
+++ b/ee/apps/stream-hub-service/Dockerfile
@@ -47,6 +47,12 @@ COPY ./ee/packages/network-broker/dist ee/packages/network-broker/dist
COPY ./ee/packages/license/package.json packages/license/package.json
COPY ./ee/packages/license/dist packages/license/dist
+COPY ./packages/random/package.json packages/random/package.json
+COPY ./packages/random/dist packages/random/dist
+
+COPY ./packages/sha256/package.json packages/sha256/package.json
+COPY ./packages/sha256/dist packages/sha256/dist
+
COPY ./packages/tracing/package.json packages/tracing/package.json
COPY ./packages/tracing/dist packages/tracing/dist
diff --git a/ee/apps/stream-hub-service/src/service.ts b/ee/apps/stream-hub-service/src/service.ts
index 07baf5923f01..1827cfeccff1 100755
--- a/ee/apps/stream-hub-service/src/service.ts
+++ b/ee/apps/stream-hub-service/src/service.ts
@@ -1,11 +1,11 @@
import { api, getConnection, getTrashCollection } from '@rocket.chat/core-services';
import { Logger } from '@rocket.chat/logger';
+import { registerServiceModels } from '@rocket.chat/models';
import { broker } from '@rocket.chat/network-broker';
import { startTracing } from '@rocket.chat/tracing';
import polka from 'polka';
import { StreamHub } from './StreamHub';
-import { registerServiceModels } from '../../../../apps/meteor/ee/server/lib/registerServiceModels';
import { DatabaseWatcher } from '../../../../apps/meteor/server/database/DatabaseWatcher';
const PORT = process.env.PORT || 3035;
From b923bad91131acf14230d832cbe58690c9dc2301 Mon Sep 17 00:00:00 2001
From: Diego Sampaio
Date: Thu, 26 Dec 2024 11:19:57 -0300
Subject: [PATCH 04/14] move dummy models
---
apps/meteor/server/models.ts | 2 +-
.../server/models => packages/models/src}/dummy/BaseDummy.ts | 0
.../server/models => packages/models/src}/dummy/ReadReceipts.ts | 0
packages/models/src/index.ts | 2 +-
4 files changed, 2 insertions(+), 2 deletions(-)
rename {apps/meteor/server/models => packages/models/src}/dummy/BaseDummy.ts (100%)
rename {apps/meteor/server/models => packages/models/src}/dummy/ReadReceipts.ts (100%)
diff --git a/apps/meteor/server/models.ts b/apps/meteor/server/models.ts
index bfb35aafbde5..154d31f3444b 100644
--- a/apps/meteor/server/models.ts
+++ b/apps/meteor/server/models.ts
@@ -4,7 +4,7 @@ import {
AppsLogsModel,
AppsModel,
AppsPersistenceModel,
- AppsTokensModel,
+ AppsTokensRaw,
AvatarsRaw,
BannersDismissRaw,
BannersRaw,
diff --git a/apps/meteor/server/models/dummy/BaseDummy.ts b/packages/models/src/dummy/BaseDummy.ts
similarity index 100%
rename from apps/meteor/server/models/dummy/BaseDummy.ts
rename to packages/models/src/dummy/BaseDummy.ts
diff --git a/apps/meteor/server/models/dummy/ReadReceipts.ts b/packages/models/src/dummy/ReadReceipts.ts
similarity index 100%
rename from apps/meteor/server/models/dummy/ReadReceipts.ts
rename to packages/models/src/dummy/ReadReceipts.ts
diff --git a/packages/models/src/index.ts b/packages/models/src/index.ts
index cacd251c3588..71bcdc528967 100644
--- a/packages/models/src/index.ts
+++ b/packages/models/src/index.ts
@@ -124,7 +124,7 @@ export function getCollectionName(name: string): string {
export * from './modelClasses';
-// export * from './dummy/ReadReceipts';
+export * from './dummy/ReadReceipts';
export { registerModel } from './proxify';
export { type Updater, UpdaterImpl } from './updater';
From de8eccd629474212e917e7520cf8459317202cb1 Mon Sep 17 00:00:00 2001
From: Diego Sampaio
Date: Thu, 26 Dec 2024 11:22:15 -0300
Subject: [PATCH 05/14] remove registerModel from meteor
---
apps/meteor/server/models/Analytics.ts | 6 --
apps/meteor/server/models/AppLogs.ts | 6 --
apps/meteor/server/models/Apps.ts | 6 --
apps/meteor/server/models/AppsPersistence.ts | 6 --
apps/meteor/server/models/AppsTokens.ts | 6 --
apps/meteor/server/models/Avatars.ts | 6 --
apps/meteor/server/models/Banners.ts | 6 --
apps/meteor/server/models/BannersDismiss.ts | 6 --
apps/meteor/server/models/CalendarEvent.ts | 6 --
apps/meteor/server/models/CredentialTokens.ts | 6 --
apps/meteor/server/models/CronHistory.ts | 6 --
apps/meteor/server/models/CustomSounds.ts | 6 --
apps/meteor/server/models/CustomUserStatus.ts | 6 --
apps/meteor/server/models/EmailInbox.ts | 6 --
.../server/models/EmailMessageHistory.ts | 6 --
apps/meteor/server/models/EmojiCustom.ts | 7 --
apps/meteor/server/models/ExportOperations.ts | 6 --
apps/meteor/server/models/FederationKeys.ts | 6 --
.../server/models/FederationRoomEvents.ts | 6 --
.../meteor/server/models/FederationServers.ts | 6 --
apps/meteor/server/models/FreeSwitchCall.ts | 6 --
apps/meteor/server/models/FreeSwitchEvent.ts | 6 --
apps/meteor/server/models/ImportData.ts | 6 --
apps/meteor/server/models/Imports.ts | 6 --
apps/meteor/server/models/InstanceStatus.ts | 6 --
.../server/models/IntegrationHistory.ts | 6 --
apps/meteor/server/models/Integrations.ts | 6 --
apps/meteor/server/models/Invites.ts | 6 --
.../server/models/LivechatAgentActivity.ts | 6 --
.../server/models/LivechatBusinessHours.ts | 6 --
apps/meteor/server/models/LivechatContacts.ts | 6 --
.../server/models/LivechatCustomField.ts | 6 --
.../server/models/LivechatDepartment.ts | 7 --
.../server/models/LivechatDepartmentAgents.ts | 7 --
apps/meteor/server/models/LivechatInquiry.ts | 7 --
apps/meteor/server/models/LivechatRooms.ts | 7 --
apps/meteor/server/models/LivechatTrigger.ts | 6 --
apps/meteor/server/models/LivechatVisitors.ts | 6 --
.../models/LoginServiceConfiguration.ts | 6 --
.../meteor/server/models/MatrixBridgedRoom.ts | 6 --
.../meteor/server/models/MatrixBridgedUser.ts | 6 --
apps/meteor/server/models/MessageReads.ts | 6 --
apps/meteor/server/models/Messages.ts | 7 --
apps/meteor/server/models/Migrations.ts | 6 --
.../meteor/server/models/ModerationReports.ts | 6 --
.../meteor/server/models/NotificationQueue.ts | 6 --
apps/meteor/server/models/Nps.ts | 6 --
apps/meteor/server/models/NpsVote.ts | 6 --
.../meteor/server/models/OAuthAccessTokens.ts | 6 --
apps/meteor/server/models/OAuthApps.ts | 6 --
apps/meteor/server/models/OAuthAuthCodes.ts | 6 --
.../server/models/OAuthRefreshTokens.ts | 6 --
apps/meteor/server/models/OEmbedCache.ts | 6 --
apps/meteor/server/models/PbxEvents.ts | 6 --
apps/meteor/server/models/Permissions.ts | 7 --
apps/meteor/server/models/PushToken.ts | 6 --
apps/meteor/server/models/ReadReceipts.ts | 5 --
apps/meteor/server/models/Reports.ts | 6 --
apps/meteor/server/models/Roles.ts | 7 --
apps/meteor/server/models/Rooms.ts | 7 --
apps/meteor/server/models/ServerEvents.ts | 6 --
apps/meteor/server/models/Sessions.ts | 6 --
apps/meteor/server/models/Settings.ts | 7 --
apps/meteor/server/models/SmarshHistory.ts | 6 --
apps/meteor/server/models/Statistics.ts | 6 --
apps/meteor/server/models/Subscriptions.ts | 7 --
apps/meteor/server/models/Team.ts | 6 --
apps/meteor/server/models/TeamMember.ts | 6 --
apps/meteor/server/models/Uploads.ts | 6 --
apps/meteor/server/models/UserDataFiles.ts | 6 --
apps/meteor/server/models/Users.ts | 6 --
apps/meteor/server/models/UsersSessions.ts | 6 --
apps/meteor/server/models/VideoConference.ts | 6 --
apps/meteor/server/models/VoipRoom.ts | 7 --
apps/meteor/server/models/WebdavAccounts.ts | 6 --
.../server/models/WorkspaceCredentials.ts | 6 --
apps/meteor/server/models/startup.ts | 75 -------------------
77 files changed, 542 deletions(-)
delete mode 100644 apps/meteor/server/models/Analytics.ts
delete mode 100644 apps/meteor/server/models/AppLogs.ts
delete mode 100644 apps/meteor/server/models/Apps.ts
delete mode 100644 apps/meteor/server/models/AppsPersistence.ts
delete mode 100644 apps/meteor/server/models/AppsTokens.ts
delete mode 100644 apps/meteor/server/models/Avatars.ts
delete mode 100644 apps/meteor/server/models/Banners.ts
delete mode 100644 apps/meteor/server/models/BannersDismiss.ts
delete mode 100644 apps/meteor/server/models/CalendarEvent.ts
delete mode 100644 apps/meteor/server/models/CredentialTokens.ts
delete mode 100644 apps/meteor/server/models/CronHistory.ts
delete mode 100644 apps/meteor/server/models/CustomSounds.ts
delete mode 100644 apps/meteor/server/models/CustomUserStatus.ts
delete mode 100644 apps/meteor/server/models/EmailInbox.ts
delete mode 100644 apps/meteor/server/models/EmailMessageHistory.ts
delete mode 100644 apps/meteor/server/models/EmojiCustom.ts
delete mode 100644 apps/meteor/server/models/ExportOperations.ts
delete mode 100644 apps/meteor/server/models/FederationKeys.ts
delete mode 100644 apps/meteor/server/models/FederationRoomEvents.ts
delete mode 100644 apps/meteor/server/models/FederationServers.ts
delete mode 100644 apps/meteor/server/models/FreeSwitchCall.ts
delete mode 100644 apps/meteor/server/models/FreeSwitchEvent.ts
delete mode 100644 apps/meteor/server/models/ImportData.ts
delete mode 100644 apps/meteor/server/models/Imports.ts
delete mode 100644 apps/meteor/server/models/InstanceStatus.ts
delete mode 100644 apps/meteor/server/models/IntegrationHistory.ts
delete mode 100644 apps/meteor/server/models/Integrations.ts
delete mode 100644 apps/meteor/server/models/Invites.ts
delete mode 100644 apps/meteor/server/models/LivechatAgentActivity.ts
delete mode 100644 apps/meteor/server/models/LivechatBusinessHours.ts
delete mode 100644 apps/meteor/server/models/LivechatContacts.ts
delete mode 100644 apps/meteor/server/models/LivechatCustomField.ts
delete mode 100644 apps/meteor/server/models/LivechatDepartment.ts
delete mode 100644 apps/meteor/server/models/LivechatDepartmentAgents.ts
delete mode 100644 apps/meteor/server/models/LivechatInquiry.ts
delete mode 100644 apps/meteor/server/models/LivechatRooms.ts
delete mode 100644 apps/meteor/server/models/LivechatTrigger.ts
delete mode 100644 apps/meteor/server/models/LivechatVisitors.ts
delete mode 100644 apps/meteor/server/models/LoginServiceConfiguration.ts
delete mode 100644 apps/meteor/server/models/MatrixBridgedRoom.ts
delete mode 100644 apps/meteor/server/models/MatrixBridgedUser.ts
delete mode 100644 apps/meteor/server/models/MessageReads.ts
delete mode 100644 apps/meteor/server/models/Messages.ts
delete mode 100644 apps/meteor/server/models/Migrations.ts
delete mode 100644 apps/meteor/server/models/ModerationReports.ts
delete mode 100644 apps/meteor/server/models/NotificationQueue.ts
delete mode 100644 apps/meteor/server/models/Nps.ts
delete mode 100644 apps/meteor/server/models/NpsVote.ts
delete mode 100644 apps/meteor/server/models/OAuthAccessTokens.ts
delete mode 100644 apps/meteor/server/models/OAuthApps.ts
delete mode 100644 apps/meteor/server/models/OAuthAuthCodes.ts
delete mode 100644 apps/meteor/server/models/OAuthRefreshTokens.ts
delete mode 100644 apps/meteor/server/models/OEmbedCache.ts
delete mode 100644 apps/meteor/server/models/PbxEvents.ts
delete mode 100644 apps/meteor/server/models/Permissions.ts
delete mode 100644 apps/meteor/server/models/PushToken.ts
delete mode 100644 apps/meteor/server/models/ReadReceipts.ts
delete mode 100644 apps/meteor/server/models/Reports.ts
delete mode 100644 apps/meteor/server/models/Roles.ts
delete mode 100644 apps/meteor/server/models/Rooms.ts
delete mode 100644 apps/meteor/server/models/ServerEvents.ts
delete mode 100644 apps/meteor/server/models/Sessions.ts
delete mode 100644 apps/meteor/server/models/Settings.ts
delete mode 100644 apps/meteor/server/models/SmarshHistory.ts
delete mode 100644 apps/meteor/server/models/Statistics.ts
delete mode 100644 apps/meteor/server/models/Subscriptions.ts
delete mode 100644 apps/meteor/server/models/Team.ts
delete mode 100644 apps/meteor/server/models/TeamMember.ts
delete mode 100644 apps/meteor/server/models/Uploads.ts
delete mode 100644 apps/meteor/server/models/UserDataFiles.ts
delete mode 100644 apps/meteor/server/models/Users.ts
delete mode 100644 apps/meteor/server/models/UsersSessions.ts
delete mode 100644 apps/meteor/server/models/VideoConference.ts
delete mode 100644 apps/meteor/server/models/VoipRoom.ts
delete mode 100644 apps/meteor/server/models/WebdavAccounts.ts
delete mode 100644 apps/meteor/server/models/WorkspaceCredentials.ts
delete mode 100644 apps/meteor/server/models/startup.ts
diff --git a/apps/meteor/server/models/Analytics.ts b/apps/meteor/server/models/Analytics.ts
deleted file mode 100644
index fd5fc32766e1..000000000000
--- a/apps/meteor/server/models/Analytics.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { AnalyticsRaw } from './raw/Analytics';
-
-registerModel('IAnalyticsModel', new AnalyticsRaw(db));
diff --git a/apps/meteor/server/models/AppLogs.ts b/apps/meteor/server/models/AppLogs.ts
deleted file mode 100644
index 7d4ebbb530d0..000000000000
--- a/apps/meteor/server/models/AppLogs.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { AppsLogsModel } from './raw/AppLogsModel';
-
-registerModel('IAppLogsModel', new AppsLogsModel(db));
diff --git a/apps/meteor/server/models/Apps.ts b/apps/meteor/server/models/Apps.ts
deleted file mode 100644
index 0f9bd3750624..000000000000
--- a/apps/meteor/server/models/Apps.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { AppsModel } from './raw/Apps';
-
-registerModel('IAppsModel', new AppsModel(db));
diff --git a/apps/meteor/server/models/AppsPersistence.ts b/apps/meteor/server/models/AppsPersistence.ts
deleted file mode 100644
index 297a10ec1e94..000000000000
--- a/apps/meteor/server/models/AppsPersistence.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { AppsPersistenceModel } from './raw/AppsPersistence';
-
-registerModel('IAppsPersistenceModel', new AppsPersistenceModel(db));
diff --git a/apps/meteor/server/models/AppsTokens.ts b/apps/meteor/server/models/AppsTokens.ts
deleted file mode 100644
index 559545b445bd..000000000000
--- a/apps/meteor/server/models/AppsTokens.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { AppsTokens } from './raw/AppsTokens';
-
-registerModel('IAppsTokensModel', new AppsTokens(db));
diff --git a/apps/meteor/server/models/Avatars.ts b/apps/meteor/server/models/Avatars.ts
deleted file mode 100644
index 1e74d72a2acc..000000000000
--- a/apps/meteor/server/models/Avatars.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { AvatarsRaw } from './raw/Avatars';
-
-registerModel('IAvatarsModel', new AvatarsRaw(db));
diff --git a/apps/meteor/server/models/Banners.ts b/apps/meteor/server/models/Banners.ts
deleted file mode 100644
index 174366f62af2..000000000000
--- a/apps/meteor/server/models/Banners.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { BannersRaw } from './raw/Banners';
-
-registerModel('IBannersModel', new BannersRaw(db));
diff --git a/apps/meteor/server/models/BannersDismiss.ts b/apps/meteor/server/models/BannersDismiss.ts
deleted file mode 100644
index 79e5ce956f03..000000000000
--- a/apps/meteor/server/models/BannersDismiss.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { BannersDismissRaw } from './raw/BannersDismiss';
-
-registerModel('IBannersDismissModel', new BannersDismissRaw(db));
diff --git a/apps/meteor/server/models/CalendarEvent.ts b/apps/meteor/server/models/CalendarEvent.ts
deleted file mode 100644
index 669ecbbdb91c..000000000000
--- a/apps/meteor/server/models/CalendarEvent.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { CalendarEventRaw } from './raw/CalendarEvent';
-
-registerModel('ICalendarEventModel', new CalendarEventRaw(db));
diff --git a/apps/meteor/server/models/CredentialTokens.ts b/apps/meteor/server/models/CredentialTokens.ts
deleted file mode 100644
index 2d88bd25dc86..000000000000
--- a/apps/meteor/server/models/CredentialTokens.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { CredentialTokensRaw } from './raw/CredentialTokens';
-
-registerModel('ICredentialTokensModel', new CredentialTokensRaw(db));
diff --git a/apps/meteor/server/models/CronHistory.ts b/apps/meteor/server/models/CronHistory.ts
deleted file mode 100644
index 2589026b9c1e..000000000000
--- a/apps/meteor/server/models/CronHistory.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { CronHistoryRaw } from './raw/CronHistoryModel';
-
-registerModel('ICronHistoryModel', new CronHistoryRaw(db));
diff --git a/apps/meteor/server/models/CustomSounds.ts b/apps/meteor/server/models/CustomSounds.ts
deleted file mode 100644
index acce42fc62ed..000000000000
--- a/apps/meteor/server/models/CustomSounds.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { CustomSoundsRaw } from './raw/CustomSounds';
-
-registerModel('ICustomSoundsModel', new CustomSoundsRaw(db));
diff --git a/apps/meteor/server/models/CustomUserStatus.ts b/apps/meteor/server/models/CustomUserStatus.ts
deleted file mode 100644
index fe62266866b4..000000000000
--- a/apps/meteor/server/models/CustomUserStatus.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { CustomUserStatusRaw } from './raw/CustomUserStatus';
-
-registerModel('ICustomUserStatusModel', new CustomUserStatusRaw(db));
diff --git a/apps/meteor/server/models/EmailInbox.ts b/apps/meteor/server/models/EmailInbox.ts
deleted file mode 100644
index 27596319c9ad..000000000000
--- a/apps/meteor/server/models/EmailInbox.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { EmailInboxRaw } from './raw/EmailInbox';
-
-registerModel('IEmailInboxModel', new EmailInboxRaw(db));
diff --git a/apps/meteor/server/models/EmailMessageHistory.ts b/apps/meteor/server/models/EmailMessageHistory.ts
deleted file mode 100644
index d5a94648d734..000000000000
--- a/apps/meteor/server/models/EmailMessageHistory.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { EmailMessageHistoryRaw } from './raw/EmailMessageHistory';
-
-registerModel('IEmailMessageHistoryModel', new EmailMessageHistoryRaw(db));
diff --git a/apps/meteor/server/models/EmojiCustom.ts b/apps/meteor/server/models/EmojiCustom.ts
deleted file mode 100644
index 0f7e9d6ef62b..000000000000
--- a/apps/meteor/server/models/EmojiCustom.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { trashCollection } from '../database/trash';
-import { db } from '../database/utils';
-import { EmojiCustomRaw } from './raw/EmojiCustom';
-
-registerModel('IEmojiCustomModel', new EmojiCustomRaw(db, trashCollection));
diff --git a/apps/meteor/server/models/ExportOperations.ts b/apps/meteor/server/models/ExportOperations.ts
deleted file mode 100644
index 332aac21ea78..000000000000
--- a/apps/meteor/server/models/ExportOperations.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { ExportOperationsRaw } from './raw/ExportOperations';
-
-registerModel('IExportOperationsModel', new ExportOperationsRaw(db));
diff --git a/apps/meteor/server/models/FederationKeys.ts b/apps/meteor/server/models/FederationKeys.ts
deleted file mode 100644
index fa7e80d4f7f1..000000000000
--- a/apps/meteor/server/models/FederationKeys.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { FederationKeysRaw } from './raw/FederationKeys';
-
-registerModel('IFederationKeysModel', new FederationKeysRaw(db));
diff --git a/apps/meteor/server/models/FederationRoomEvents.ts b/apps/meteor/server/models/FederationRoomEvents.ts
deleted file mode 100644
index 67aefab9825e..000000000000
--- a/apps/meteor/server/models/FederationRoomEvents.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { FederationRoomEvents } from './raw/FederationRoomEvents';
-
-registerModel('IFederationRoomEventsModel', new FederationRoomEvents(db));
diff --git a/apps/meteor/server/models/FederationServers.ts b/apps/meteor/server/models/FederationServers.ts
deleted file mode 100644
index b4c0cf1a3584..000000000000
--- a/apps/meteor/server/models/FederationServers.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { FederationServersRaw } from './raw/FederationServers';
-
-registerModel('IFederationServersModel', new FederationServersRaw(db));
diff --git a/apps/meteor/server/models/FreeSwitchCall.ts b/apps/meteor/server/models/FreeSwitchCall.ts
deleted file mode 100644
index 97b470538e80..000000000000
--- a/apps/meteor/server/models/FreeSwitchCall.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { FreeSwitchCallRaw } from './raw/FreeSwitchCall';
-
-registerModel('IFreeSwitchCallModel', new FreeSwitchCallRaw(db));
diff --git a/apps/meteor/server/models/FreeSwitchEvent.ts b/apps/meteor/server/models/FreeSwitchEvent.ts
deleted file mode 100644
index cab4d7daa2e4..000000000000
--- a/apps/meteor/server/models/FreeSwitchEvent.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { FreeSwitchEventRaw } from './raw/FreeSwitchEvent';
-
-registerModel('IFreeSwitchEventModel', new FreeSwitchEventRaw(db));
diff --git a/apps/meteor/server/models/ImportData.ts b/apps/meteor/server/models/ImportData.ts
deleted file mode 100644
index ac3ee0b05f13..000000000000
--- a/apps/meteor/server/models/ImportData.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { ImportDataRaw } from './raw/ImportData';
-
-registerModel('IImportDataModel', new ImportDataRaw(db));
diff --git a/apps/meteor/server/models/Imports.ts b/apps/meteor/server/models/Imports.ts
deleted file mode 100644
index 72f9e0eb014c..000000000000
--- a/apps/meteor/server/models/Imports.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { ImportsModel } from './raw/Imports';
-
-registerModel('IImportsModel', new ImportsModel(db));
diff --git a/apps/meteor/server/models/InstanceStatus.ts b/apps/meteor/server/models/InstanceStatus.ts
deleted file mode 100644
index 571a16e6bd85..000000000000
--- a/apps/meteor/server/models/InstanceStatus.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { InstanceStatusRaw } from './raw/InstanceStatus';
-
-registerModel('IInstanceStatusModel', new InstanceStatusRaw(db));
diff --git a/apps/meteor/server/models/IntegrationHistory.ts b/apps/meteor/server/models/IntegrationHistory.ts
deleted file mode 100644
index 839d143a7cd7..000000000000
--- a/apps/meteor/server/models/IntegrationHistory.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { IntegrationHistoryRaw } from './raw/IntegrationHistory';
-
-registerModel('IIntegrationHistoryModel', new IntegrationHistoryRaw(db));
diff --git a/apps/meteor/server/models/Integrations.ts b/apps/meteor/server/models/Integrations.ts
deleted file mode 100644
index 50b7059e6232..000000000000
--- a/apps/meteor/server/models/Integrations.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { IntegrationsRaw } from './raw/Integrations';
-
-registerModel('IIntegrationsModel', new IntegrationsRaw(db));
diff --git a/apps/meteor/server/models/Invites.ts b/apps/meteor/server/models/Invites.ts
deleted file mode 100644
index 0419ada05df8..000000000000
--- a/apps/meteor/server/models/Invites.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { InvitesRaw } from './raw/Invites';
-
-registerModel('IInvitesModel', new InvitesRaw(db));
diff --git a/apps/meteor/server/models/LivechatAgentActivity.ts b/apps/meteor/server/models/LivechatAgentActivity.ts
deleted file mode 100644
index 4fdb3b8e3697..000000000000
--- a/apps/meteor/server/models/LivechatAgentActivity.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { LivechatAgentActivityRaw } from './raw/LivechatAgentActivity';
-
-registerModel('ILivechatAgentActivityModel', new LivechatAgentActivityRaw(db));
diff --git a/apps/meteor/server/models/LivechatBusinessHours.ts b/apps/meteor/server/models/LivechatBusinessHours.ts
deleted file mode 100644
index be1aff0a7f9e..000000000000
--- a/apps/meteor/server/models/LivechatBusinessHours.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { LivechatBusinessHoursRaw } from './raw/LivechatBusinessHours';
-
-registerModel('ILivechatBusinessHoursModel', new LivechatBusinessHoursRaw(db));
diff --git a/apps/meteor/server/models/LivechatContacts.ts b/apps/meteor/server/models/LivechatContacts.ts
deleted file mode 100644
index d341ae87b021..000000000000
--- a/apps/meteor/server/models/LivechatContacts.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { LivechatContactsRaw } from './raw/LivechatContacts';
-
-registerModel('ILivechatContactsModel', new LivechatContactsRaw(db));
diff --git a/apps/meteor/server/models/LivechatCustomField.ts b/apps/meteor/server/models/LivechatCustomField.ts
deleted file mode 100644
index 25e6af9366e0..000000000000
--- a/apps/meteor/server/models/LivechatCustomField.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { LivechatCustomFieldRaw } from './raw/LivechatCustomField';
-
-registerModel('ILivechatCustomFieldModel', new LivechatCustomFieldRaw(db));
diff --git a/apps/meteor/server/models/LivechatDepartment.ts b/apps/meteor/server/models/LivechatDepartment.ts
deleted file mode 100644
index 3e1eec2a945d..000000000000
--- a/apps/meteor/server/models/LivechatDepartment.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { trashCollection } from '../database/trash';
-import { db } from '../database/utils';
-import { LivechatDepartmentRaw } from './raw/LivechatDepartment';
-
-registerModel('ILivechatDepartmentModel', new LivechatDepartmentRaw(db, trashCollection));
diff --git a/apps/meteor/server/models/LivechatDepartmentAgents.ts b/apps/meteor/server/models/LivechatDepartmentAgents.ts
deleted file mode 100644
index 26b79260c81f..000000000000
--- a/apps/meteor/server/models/LivechatDepartmentAgents.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { trashCollection } from '../database/trash';
-import { db } from '../database/utils';
-import { LivechatDepartmentAgentsRaw } from './raw/LivechatDepartmentAgents';
-
-registerModel('ILivechatDepartmentAgentsModel', new LivechatDepartmentAgentsRaw(db, trashCollection));
diff --git a/apps/meteor/server/models/LivechatInquiry.ts b/apps/meteor/server/models/LivechatInquiry.ts
deleted file mode 100644
index cb14c207027b..000000000000
--- a/apps/meteor/server/models/LivechatInquiry.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { trashCollection } from '../database/trash';
-import { db } from '../database/utils';
-import { LivechatInquiryRaw } from './raw/LivechatInquiry';
-
-registerModel('ILivechatInquiryModel', new LivechatInquiryRaw(db, trashCollection));
diff --git a/apps/meteor/server/models/LivechatRooms.ts b/apps/meteor/server/models/LivechatRooms.ts
deleted file mode 100644
index 0e84584c0d88..000000000000
--- a/apps/meteor/server/models/LivechatRooms.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { trashCollection } from '../database/trash';
-import { db } from '../database/utils';
-import { LivechatRoomsRaw } from './raw/LivechatRooms';
-
-registerModel('ILivechatRoomsModel', new LivechatRoomsRaw(db, trashCollection));
diff --git a/apps/meteor/server/models/LivechatTrigger.ts b/apps/meteor/server/models/LivechatTrigger.ts
deleted file mode 100644
index 2c3221d4f59f..000000000000
--- a/apps/meteor/server/models/LivechatTrigger.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { LivechatTriggerRaw } from './raw/LivechatTrigger';
-
-registerModel('ILivechatTriggerModel', new LivechatTriggerRaw(db));
diff --git a/apps/meteor/server/models/LivechatVisitors.ts b/apps/meteor/server/models/LivechatVisitors.ts
deleted file mode 100644
index 81111ff842fa..000000000000
--- a/apps/meteor/server/models/LivechatVisitors.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { LivechatVisitorsRaw } from './raw/LivechatVisitors';
-
-registerModel('ILivechatVisitorsModel', new LivechatVisitorsRaw(db));
diff --git a/apps/meteor/server/models/LoginServiceConfiguration.ts b/apps/meteor/server/models/LoginServiceConfiguration.ts
deleted file mode 100644
index dd4f7dbae6de..000000000000
--- a/apps/meteor/server/models/LoginServiceConfiguration.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { LoginServiceConfigurationRaw } from './raw/LoginServiceConfiguration';
-
-registerModel('ILoginServiceConfigurationModel', new LoginServiceConfigurationRaw(db));
diff --git a/apps/meteor/server/models/MatrixBridgedRoom.ts b/apps/meteor/server/models/MatrixBridgedRoom.ts
deleted file mode 100644
index 38dbdac880b6..000000000000
--- a/apps/meteor/server/models/MatrixBridgedRoom.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { MatrixBridgedRoomRaw } from './raw/MatrixBridgedRoom';
-
-registerModel('IMatrixBridgedRoomModel', new MatrixBridgedRoomRaw(db));
diff --git a/apps/meteor/server/models/MatrixBridgedUser.ts b/apps/meteor/server/models/MatrixBridgedUser.ts
deleted file mode 100644
index 7f813748ae50..000000000000
--- a/apps/meteor/server/models/MatrixBridgedUser.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { MatrixBridgedUserRaw } from './raw/MatrixBridgedUser';
-
-registerModel('IMatrixBridgedUserModel', new MatrixBridgedUserRaw(db));
diff --git a/apps/meteor/server/models/MessageReads.ts b/apps/meteor/server/models/MessageReads.ts
deleted file mode 100644
index 43984e9e2b4a..000000000000
--- a/apps/meteor/server/models/MessageReads.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { MessageReadsRaw } from './raw/MessageReads';
-
-registerModel('IMessageReadsModel', new MessageReadsRaw(db));
diff --git a/apps/meteor/server/models/Messages.ts b/apps/meteor/server/models/Messages.ts
deleted file mode 100644
index e9de00514627..000000000000
--- a/apps/meteor/server/models/Messages.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { trashCollection } from '../database/trash';
-import { db } from '../database/utils';
-import { MessagesRaw } from './raw/Messages';
-
-registerModel('IMessagesModel', new MessagesRaw(db, trashCollection));
diff --git a/apps/meteor/server/models/Migrations.ts b/apps/meteor/server/models/Migrations.ts
deleted file mode 100644
index 41e98fac1151..000000000000
--- a/apps/meteor/server/models/Migrations.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { MigrationsRaw } from './raw/Migrations';
-
-registerModel('IMigrationsModel', new MigrationsRaw(db));
diff --git a/apps/meteor/server/models/ModerationReports.ts b/apps/meteor/server/models/ModerationReports.ts
deleted file mode 100644
index e3014ef849b8..000000000000
--- a/apps/meteor/server/models/ModerationReports.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { ModerationReportsRaw } from './raw/ModerationReports';
-
-registerModel('IModerationReportsModel', () => new ModerationReportsRaw(db));
diff --git a/apps/meteor/server/models/NotificationQueue.ts b/apps/meteor/server/models/NotificationQueue.ts
deleted file mode 100644
index 68d729f49d95..000000000000
--- a/apps/meteor/server/models/NotificationQueue.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { NotificationQueueRaw } from './raw/NotificationQueue';
-
-registerModel('INotificationQueueModel', new NotificationQueueRaw(db));
diff --git a/apps/meteor/server/models/Nps.ts b/apps/meteor/server/models/Nps.ts
deleted file mode 100644
index 4cdf7a4a31af..000000000000
--- a/apps/meteor/server/models/Nps.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { NpsRaw } from './raw/Nps';
-
-registerModel('INpsModel', new NpsRaw(db));
diff --git a/apps/meteor/server/models/NpsVote.ts b/apps/meteor/server/models/NpsVote.ts
deleted file mode 100644
index e784ad789dbc..000000000000
--- a/apps/meteor/server/models/NpsVote.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { NpsVoteRaw } from './raw/NpsVote';
-
-registerModel('INpsVoteModel', new NpsVoteRaw(db));
diff --git a/apps/meteor/server/models/OAuthAccessTokens.ts b/apps/meteor/server/models/OAuthAccessTokens.ts
deleted file mode 100644
index ec6fa236a5d6..000000000000
--- a/apps/meteor/server/models/OAuthAccessTokens.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { OAuthAccessTokensRaw } from './raw/OAuthAccessTokens';
-
-registerModel('IOAuthAccessTokensModel', new OAuthAccessTokensRaw(db));
diff --git a/apps/meteor/server/models/OAuthApps.ts b/apps/meteor/server/models/OAuthApps.ts
deleted file mode 100644
index e56bcae5914c..000000000000
--- a/apps/meteor/server/models/OAuthApps.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { OAuthAppsRaw } from './raw/OAuthApps';
-
-registerModel('IOAuthAppsModel', new OAuthAppsRaw(db));
diff --git a/apps/meteor/server/models/OAuthAuthCodes.ts b/apps/meteor/server/models/OAuthAuthCodes.ts
deleted file mode 100644
index fa7f422425b8..000000000000
--- a/apps/meteor/server/models/OAuthAuthCodes.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { OAuthAuthCodesRaw } from './raw/OAuthAuthCodes';
-
-registerModel('IOAuthAuthCodesModel', new OAuthAuthCodesRaw(db));
diff --git a/apps/meteor/server/models/OAuthRefreshTokens.ts b/apps/meteor/server/models/OAuthRefreshTokens.ts
deleted file mode 100644
index 9c5dad78a98f..000000000000
--- a/apps/meteor/server/models/OAuthRefreshTokens.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { OAuthRefreshTokensRaw } from './raw/OAuthRefreshTokens';
-
-registerModel('IOAuthRefreshTokensModel', new OAuthRefreshTokensRaw(db));
diff --git a/apps/meteor/server/models/OEmbedCache.ts b/apps/meteor/server/models/OEmbedCache.ts
deleted file mode 100644
index 4836ea556937..000000000000
--- a/apps/meteor/server/models/OEmbedCache.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { OEmbedCacheRaw } from './raw/OEmbedCache';
-
-registerModel('IOEmbedCacheModel', new OEmbedCacheRaw(db));
diff --git a/apps/meteor/server/models/PbxEvents.ts b/apps/meteor/server/models/PbxEvents.ts
deleted file mode 100644
index 82ba25a392db..000000000000
--- a/apps/meteor/server/models/PbxEvents.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { PbxEventsRaw } from './raw/PbxEvents';
-
-registerModel('IPbxEventsModel', new PbxEventsRaw(db));
diff --git a/apps/meteor/server/models/Permissions.ts b/apps/meteor/server/models/Permissions.ts
deleted file mode 100644
index edbf68dbfc59..000000000000
--- a/apps/meteor/server/models/Permissions.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { trashCollection } from '../database/trash';
-import { db } from '../database/utils';
-import { PermissionsRaw } from './raw/Permissions';
-
-registerModel('IPermissionsModel', new PermissionsRaw(db, trashCollection));
diff --git a/apps/meteor/server/models/PushToken.ts b/apps/meteor/server/models/PushToken.ts
deleted file mode 100644
index 16df39673dd7..000000000000
--- a/apps/meteor/server/models/PushToken.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { PushTokenRaw } from './raw/PushToken';
-
-registerModel('IPushTokenModel', new PushTokenRaw(db));
diff --git a/apps/meteor/server/models/ReadReceipts.ts b/apps/meteor/server/models/ReadReceipts.ts
deleted file mode 100644
index 5faf90c33546..000000000000
--- a/apps/meteor/server/models/ReadReceipts.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { ReadReceiptsDummy } from './dummy/ReadReceipts';
-
-registerModel('IReadReceiptsModel', new ReadReceiptsDummy(), false);
diff --git a/apps/meteor/server/models/Reports.ts b/apps/meteor/server/models/Reports.ts
deleted file mode 100644
index ec328bc0b5d6..000000000000
--- a/apps/meteor/server/models/Reports.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { ReportsRaw } from './raw/Reports';
-
-registerModel('IReportsModel', new ReportsRaw(db));
diff --git a/apps/meteor/server/models/Roles.ts b/apps/meteor/server/models/Roles.ts
deleted file mode 100644
index f4f924b5acca..000000000000
--- a/apps/meteor/server/models/Roles.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { trashCollection } from '../database/trash';
-import { db } from '../database/utils';
-import { RolesRaw } from './raw/Roles';
-
-registerModel('IRolesModel', new RolesRaw(db, trashCollection));
diff --git a/apps/meteor/server/models/Rooms.ts b/apps/meteor/server/models/Rooms.ts
deleted file mode 100644
index 59d4ccc9f2c4..000000000000
--- a/apps/meteor/server/models/Rooms.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { trashCollection } from '../database/trash';
-import { db } from '../database/utils';
-import { RoomsRaw } from './raw/Rooms';
-
-registerModel('IRoomsModel', new RoomsRaw(db, trashCollection));
diff --git a/apps/meteor/server/models/ServerEvents.ts b/apps/meteor/server/models/ServerEvents.ts
deleted file mode 100644
index 997026f7b515..000000000000
--- a/apps/meteor/server/models/ServerEvents.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { ServerEventsRaw } from './raw/ServerEvents';
-
-registerModel('IServerEventsModel', new ServerEventsRaw(db));
diff --git a/apps/meteor/server/models/Sessions.ts b/apps/meteor/server/models/Sessions.ts
deleted file mode 100644
index 9abe142be3a8..000000000000
--- a/apps/meteor/server/models/Sessions.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { SessionsRaw } from './raw/Sessions';
-
-registerModel('ISessionsModel', new SessionsRaw(db));
diff --git a/apps/meteor/server/models/Settings.ts b/apps/meteor/server/models/Settings.ts
deleted file mode 100644
index bd14012e1f6a..000000000000
--- a/apps/meteor/server/models/Settings.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { trashCollection } from '../database/trash';
-import { db } from '../database/utils';
-import { SettingsRaw } from './raw/Settings';
-
-registerModel('ISettingsModel', new SettingsRaw(db, trashCollection));
diff --git a/apps/meteor/server/models/SmarshHistory.ts b/apps/meteor/server/models/SmarshHistory.ts
deleted file mode 100644
index 9414a37993c0..000000000000
--- a/apps/meteor/server/models/SmarshHistory.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { SmarshHistoryRaw } from './raw/SmarshHistory';
-
-registerModel('ISmarshHistoryModel', new SmarshHistoryRaw(db));
diff --git a/apps/meteor/server/models/Statistics.ts b/apps/meteor/server/models/Statistics.ts
deleted file mode 100644
index 9a9d69d3bc22..000000000000
--- a/apps/meteor/server/models/Statistics.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { StatisticsRaw } from './raw/Statistics';
-
-registerModel('IStatisticsModel', new StatisticsRaw(db));
diff --git a/apps/meteor/server/models/Subscriptions.ts b/apps/meteor/server/models/Subscriptions.ts
deleted file mode 100644
index 36a8d75ad49d..000000000000
--- a/apps/meteor/server/models/Subscriptions.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { trashCollection } from '../database/trash';
-import { db } from '../database/utils';
-import { SubscriptionsRaw } from './raw/Subscriptions';
-
-registerModel('ISubscriptionsModel', new SubscriptionsRaw(db, trashCollection));
diff --git a/apps/meteor/server/models/Team.ts b/apps/meteor/server/models/Team.ts
deleted file mode 100644
index 5c1264c6e2a4..000000000000
--- a/apps/meteor/server/models/Team.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { TeamRaw } from './raw/Team';
-
-registerModel('ITeamModel', new TeamRaw(db));
diff --git a/apps/meteor/server/models/TeamMember.ts b/apps/meteor/server/models/TeamMember.ts
deleted file mode 100644
index 7c34bea74b7b..000000000000
--- a/apps/meteor/server/models/TeamMember.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { TeamMemberRaw } from './raw/TeamMember';
-
-registerModel('ITeamMemberModel', new TeamMemberRaw(db));
diff --git a/apps/meteor/server/models/Uploads.ts b/apps/meteor/server/models/Uploads.ts
deleted file mode 100644
index 1aee2cef260c..000000000000
--- a/apps/meteor/server/models/Uploads.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { UploadsRaw } from './raw/Uploads';
-
-registerModel('IUploadsModel', new UploadsRaw(db));
diff --git a/apps/meteor/server/models/UserDataFiles.ts b/apps/meteor/server/models/UserDataFiles.ts
deleted file mode 100644
index 72fa09dccc2f..000000000000
--- a/apps/meteor/server/models/UserDataFiles.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { UserDataFilesRaw } from './raw/UserDataFiles';
-
-registerModel('IUserDataFilesModel', new UserDataFilesRaw(db));
diff --git a/apps/meteor/server/models/Users.ts b/apps/meteor/server/models/Users.ts
deleted file mode 100644
index b9b7ad6298a7..000000000000
--- a/apps/meteor/server/models/Users.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { UsersRaw } from './raw/Users';
-
-registerModel('IUsersModel', new UsersRaw(db));
diff --git a/apps/meteor/server/models/UsersSessions.ts b/apps/meteor/server/models/UsersSessions.ts
deleted file mode 100644
index d7cca6105523..000000000000
--- a/apps/meteor/server/models/UsersSessions.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { UsersSessionsRaw } from './raw/UsersSessions';
-
-registerModel('IUsersSessionsModel', new UsersSessionsRaw(db));
diff --git a/apps/meteor/server/models/VideoConference.ts b/apps/meteor/server/models/VideoConference.ts
deleted file mode 100644
index 7c052ef304dc..000000000000
--- a/apps/meteor/server/models/VideoConference.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { VideoConferenceRaw } from './raw/VideoConference';
-
-registerModel('IVideoConferenceModel', new VideoConferenceRaw(db));
diff --git a/apps/meteor/server/models/VoipRoom.ts b/apps/meteor/server/models/VoipRoom.ts
deleted file mode 100644
index e743b7185a92..000000000000
--- a/apps/meteor/server/models/VoipRoom.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { trashCollection } from '../database/trash';
-import { db } from '../database/utils';
-import { VoipRoomRaw } from './raw/VoipRoom';
-
-registerModel('IVoipRoomModel', new VoipRoomRaw(db, trashCollection));
diff --git a/apps/meteor/server/models/WebdavAccounts.ts b/apps/meteor/server/models/WebdavAccounts.ts
deleted file mode 100644
index 3ae1e07f9ca1..000000000000
--- a/apps/meteor/server/models/WebdavAccounts.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { WebdavAccountsRaw } from './raw/WebdavAccounts';
-
-registerModel('IWebdavAccountsModel', new WebdavAccountsRaw(db));
diff --git a/apps/meteor/server/models/WorkspaceCredentials.ts b/apps/meteor/server/models/WorkspaceCredentials.ts
deleted file mode 100644
index 7901f2bfef2d..000000000000
--- a/apps/meteor/server/models/WorkspaceCredentials.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { db } from '../database/utils';
-import { WorkspaceCredentialsRaw } from './raw/WorkspaceCredentials';
-
-registerModel('IWorkspaceCredentialsModel', new WorkspaceCredentialsRaw(db));
diff --git a/apps/meteor/server/models/startup.ts b/apps/meteor/server/models/startup.ts
deleted file mode 100644
index a03c2265c683..000000000000
--- a/apps/meteor/server/models/startup.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-import './Analytics';
-import './Apps';
-import './AppLogs';
-import './AppsPersistence';
-import './Avatars';
-import './Banners';
-import './BannersDismiss';
-import './CalendarEvent';
-import './CredentialTokens';
-import './CustomSounds';
-import './CustomUserStatus';
-import './EmailInbox';
-import './EmailMessageHistory';
-import './EmojiCustom';
-import './ExportOperations';
-import './FederationKeys';
-import './FederationServers';
-import './FreeSwitchCall';
-import './FreeSwitchEvent';
-import './ImportData';
-import './InstanceStatus';
-import './IntegrationHistory';
-import './Integrations';
-import './Invites';
-import './LivechatAgentActivity';
-import './LivechatBusinessHours';
-import './LivechatContacts';
-import './LivechatCustomField';
-import './LivechatDepartment';
-import './LivechatDepartmentAgents';
-import './LivechatInquiry';
-import './LivechatRooms';
-import './LivechatTrigger';
-import './LivechatVisitors';
-import './LoginServiceConfiguration';
-import './MatrixBridgedRoom';
-import './MatrixBridgedUser';
-import './Messages';
-import './NotificationQueue';
-import './Nps';
-import './NpsVote';
-import './OAuthApps';
-import './OAuthAuthCodes';
-import './OAuthAccessTokens';
-import './OAuthRefreshTokens';
-import './OEmbedCache';
-import './PbxEvents';
-import './PushToken';
-import './Permissions';
-import './MessageReads';
-import './ModerationReports';
-import './Roles';
-import './Rooms';
-import './ServerEvents';
-import './Sessions';
-import './Settings';
-import './SmarshHistory';
-import './Statistics';
-import './Subscriptions';
-import './Team';
-import './TeamMember';
-import './Uploads';
-import './UserDataFiles';
-import './Users';
-import './UsersSessions';
-import './VideoConference';
-import './VoipRoom';
-import './WebdavAccounts';
-import './FederationRoomEvents';
-import './Imports';
-import './AppsTokens';
-import './CronHistory';
-import './Migrations';
-import './ReadReceipts';
-import './WorkspaceCredentials';
From f8d9668a6a2bab246ddd963a2781f635654e0a39 Mon Sep 17 00:00:00 2001
From: Diego Sampaio
Date: Thu, 26 Dec 2024 11:28:12 -0300
Subject: [PATCH 06/14] fix basedummy
---
packages/models/src/dummy/BaseDummy.ts | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/packages/models/src/dummy/BaseDummy.ts b/packages/models/src/dummy/BaseDummy.ts
index 049295c1a28a..c30208df4d6c 100644
--- a/packages/models/src/dummy/BaseDummy.ts
+++ b/packages/models/src/dummy/BaseDummy.ts
@@ -1,7 +1,5 @@
import type { RocketChatRecordDeleted } from '@rocket.chat/core-typings';
import type { DefaultFields, FindPaginated, IBaseModel, InsertionModel, ResultFields } from '@rocket.chat/model-typings';
-import { getCollectionName, UpdaterImpl } from '@rocket.chat/models';
-import type { Updater } from '@rocket.chat/models';
import type {
BulkWriteOptions,
ChangeStream,
@@ -22,6 +20,9 @@ import type {
WithId,
} from 'mongodb';
+import { getCollectionName, UpdaterImpl } from '../index';
+import type { Updater } from '../updater';
+
export class BaseDummy<
T extends { _id: string },
C extends DefaultFields = undefined,
From 581224f08c63e5d725b15782532e9fdcdf19946a Mon Sep 17 00:00:00 2001
From: Diego Sampaio
Date: Thu, 26 Dec 2024 11:38:10 -0300
Subject: [PATCH 07/14] fix imports
---
apps/meteor/app/statistics/server/lib/SAUMonitor.ts | 3 +--
apps/meteor/ee/server/models/raw/AuditLog.ts | 3 +--
apps/meteor/ee/server/models/raw/CannedResponse.ts | 3 +--
apps/meteor/ee/server/models/raw/LivechatDepartment.ts | 4 +---
apps/meteor/ee/server/models/raw/LivechatDepartmentAgents.ts | 3 +--
apps/meteor/ee/server/models/raw/LivechatInquiry.ts | 3 +--
apps/meteor/ee/server/models/raw/LivechatPriority.ts | 3 +--
apps/meteor/ee/server/models/raw/LivechatRooms.ts | 2 +-
apps/meteor/ee/server/models/raw/LivechatTag.ts | 3 +--
apps/meteor/ee/server/models/raw/LivechatUnit.ts | 3 +--
apps/meteor/ee/server/models/raw/LivechatUnitMonitors.ts | 3 +--
apps/meteor/ee/server/models/raw/ReadReceipts.ts | 2 +-
apps/meteor/ee/server/models/raw/ServiceLevelAgreements.ts | 3 +--
apps/meteor/ee/server/models/raw/Users.ts | 2 +-
apps/meteor/server/database/trash.ts | 3 ++-
15 files changed, 16 insertions(+), 27 deletions(-)
diff --git a/apps/meteor/app/statistics/server/lib/SAUMonitor.ts b/apps/meteor/app/statistics/server/lib/SAUMonitor.ts
index e1cdab7f0773..aee710292636 100644
--- a/apps/meteor/app/statistics/server/lib/SAUMonitor.ts
+++ b/apps/meteor/app/statistics/server/lib/SAUMonitor.ts
@@ -1,7 +1,7 @@
import type { ISession, ISessionDevice, ISocketConnectionLogged, IUser } from '@rocket.chat/core-typings';
import { cronJobs } from '@rocket.chat/cron';
import { Logger } from '@rocket.chat/logger';
-import { Sessions, Users } from '@rocket.chat/models';
+import { Sessions, Users, aggregates } from '@rocket.chat/models';
import mem from 'mem';
import { Meteor } from 'meteor/meteor';
import UAParser from 'ua-parser-js';
@@ -9,7 +9,6 @@ import UAParser from 'ua-parser-js';
import { UAParserMobile, UAParserDesktop } from './UAParserCustom';
import { getMostImportantRole } from '../../../../lib/roles/getMostImportantRole';
import { getClientAddress } from '../../../../server/lib/getClientAddress';
-import { aggregates } from '../../../../server/models/raw/Sessions';
import { sauEvents } from '../../../../server/services/sauMonitor/events';
type DateObj = { day: number; month: number; year: number };
diff --git a/apps/meteor/ee/server/models/raw/AuditLog.ts b/apps/meteor/ee/server/models/raw/AuditLog.ts
index e0c70d3290bb..62e86aae1793 100644
--- a/apps/meteor/ee/server/models/raw/AuditLog.ts
+++ b/apps/meteor/ee/server/models/raw/AuditLog.ts
@@ -1,8 +1,7 @@
import type { RocketChatRecordDeleted, IAuditLog } from '@rocket.chat/core-typings';
+import { BaseRaw } from '@rocket.chat/models';
import type { Collection, Db } from 'mongodb';
-import { BaseRaw } from '../../../../server/models/raw/BaseRaw';
-
export class AuditLogRaw extends BaseRaw {
constructor(db: Db, trash?: Collection>) {
super(db, 'audit_log', trash);
diff --git a/apps/meteor/ee/server/models/raw/CannedResponse.ts b/apps/meteor/ee/server/models/raw/CannedResponse.ts
index e897db928dc2..fdfb4a02d97b 100644
--- a/apps/meteor/ee/server/models/raw/CannedResponse.ts
+++ b/apps/meteor/ee/server/models/raw/CannedResponse.ts
@@ -1,9 +1,8 @@
import type { IOmnichannelCannedResponse } from '@rocket.chat/core-typings';
import type { ICannedResponseModel } from '@rocket.chat/model-typings';
+import { BaseRaw } from '@rocket.chat/models';
import type { Db, DeleteResult, FindCursor, FindOptions, IndexDescription, UpdateFilter } from 'mongodb';
-import { BaseRaw } from '../../../../server/models/raw/BaseRaw';
-
// TODO need to define type for CannedResponse object
export class CannedResponseRaw extends BaseRaw implements ICannedResponseModel {
constructor(db: Db) {
diff --git a/apps/meteor/ee/server/models/raw/LivechatDepartment.ts b/apps/meteor/ee/server/models/raw/LivechatDepartment.ts
index 3586c4b836d1..50a17da13b65 100644
--- a/apps/meteor/ee/server/models/raw/LivechatDepartment.ts
+++ b/apps/meteor/ee/server/models/raw/LivechatDepartment.ts
@@ -1,6 +1,6 @@
import type { ILivechatDepartment, RocketChatRecordDeleted, LivechatDepartmentDTO } from '@rocket.chat/core-typings';
import type { ILivechatDepartmentModel } from '@rocket.chat/model-typings';
-import { LivechatUnit } from '@rocket.chat/models';
+import { LivechatUnit, LivechatDepartmentRaw } from '@rocket.chat/models';
import type {
Collection,
DeleteResult,
@@ -14,8 +14,6 @@ import type {
AggregationCursor,
} from 'mongodb';
-import { LivechatDepartmentRaw } from '../../../../server/models/raw/LivechatDepartment';
-
declare module '@rocket.chat/model-typings' {
interface ILivechatDepartmentModel {
removeDepartmentFromForwardListById(departmentId: string): Promise;
diff --git a/apps/meteor/ee/server/models/raw/LivechatDepartmentAgents.ts b/apps/meteor/ee/server/models/raw/LivechatDepartmentAgents.ts
index 0c04ed355ce6..a7a661225459 100644
--- a/apps/meteor/ee/server/models/raw/LivechatDepartmentAgents.ts
+++ b/apps/meteor/ee/server/models/raw/LivechatDepartmentAgents.ts
@@ -1,6 +1,5 @@
import type { ILivechatDepartmentAgents } from '@rocket.chat/core-typings';
-
-import { LivechatDepartmentAgentsRaw } from '../../../../server/models/raw/LivechatDepartmentAgents';
+import { LivechatDepartmentAgentsRaw } from '@rocket.chat/models';
export class LivechatDepartmentAgents extends LivechatDepartmentAgentsRaw {
findAgentsByAgentIdAndBusinessHourId(agentId: string, businessHourId: string): Promise {
diff --git a/apps/meteor/ee/server/models/raw/LivechatInquiry.ts b/apps/meteor/ee/server/models/raw/LivechatInquiry.ts
index 75e09019db22..12a6c60b9ed3 100644
--- a/apps/meteor/ee/server/models/raw/LivechatInquiry.ts
+++ b/apps/meteor/ee/server/models/raw/LivechatInquiry.ts
@@ -1,10 +1,9 @@
import type { ILivechatInquiryRecord, ILivechatPriority } from '@rocket.chat/core-typings';
import { DEFAULT_SLA_CONFIG, LivechatPriorityWeight } from '@rocket.chat/core-typings';
import type { ILivechatInquiryModel } from '@rocket.chat/model-typings';
+import { LivechatInquiryRaw } from '@rocket.chat/models';
import type { ModifyResult, UpdateResult, Document } from 'mongodb';
-import { LivechatInquiryRaw } from '../../../../server/models/raw/LivechatInquiry';
-
declare module '@rocket.chat/model-typings' {
interface ILivechatInquiryModel {
setSlaForRoom(rid: string, sla: { estimatedWaitingTimeQueue: number; slaId: string }): Promise>;
diff --git a/apps/meteor/ee/server/models/raw/LivechatPriority.ts b/apps/meteor/ee/server/models/raw/LivechatPriority.ts
index 61f8ac9a1ab9..ae8bdfd81d55 100644
--- a/apps/meteor/ee/server/models/raw/LivechatPriority.ts
+++ b/apps/meteor/ee/server/models/raw/LivechatPriority.ts
@@ -1,10 +1,9 @@
import type { ILivechatPriority } from '@rocket.chat/core-typings';
import type { ILivechatPriorityModel } from '@rocket.chat/model-typings';
+import { BaseRaw } from '@rocket.chat/models';
import { escapeRegExp } from '@rocket.chat/string-helpers';
import type { Db, UpdateFilter, ModifyResult, IndexDescription, FindCursor } from 'mongodb';
-import { BaseRaw } from '../../../../server/models/raw/BaseRaw';
-
// TODO need to define type for LivechatPriority object
export class LivechatPriorityRaw extends BaseRaw implements ILivechatPriorityModel {
constructor(db: Db) {
diff --git a/apps/meteor/ee/server/models/raw/LivechatRooms.ts b/apps/meteor/ee/server/models/raw/LivechatRooms.ts
index 9e8cdc0b8486..df099608f9bf 100644
--- a/apps/meteor/ee/server/models/raw/LivechatRooms.ts
+++ b/apps/meteor/ee/server/models/raw/LivechatRooms.ts
@@ -9,11 +9,11 @@ import type {
import { LivechatPriorityWeight, DEFAULT_SLA_CONFIG } from '@rocket.chat/core-typings';
import type { FindPaginated, ILivechatRoomsModel } from '@rocket.chat/model-typings';
import type { Updater } from '@rocket.chat/models';
+import { LivechatRoomsRaw } from '@rocket.chat/models';
import { escapeRegExp } from '@rocket.chat/string-helpers';
import type { FindCursor, UpdateResult, Document, FindOptions, Db, Collection, Filter, AggregationCursor, UpdateOptions } from 'mongodb';
import { readSecondaryPreferred } from '../../../../server/database/readSecondaryPreferred';
-import { LivechatRoomsRaw } from '../../../../server/models/raw/LivechatRooms';
declare module '@rocket.chat/model-typings' {
interface ILivechatRoomsModel {
diff --git a/apps/meteor/ee/server/models/raw/LivechatTag.ts b/apps/meteor/ee/server/models/raw/LivechatTag.ts
index a4314c569f46..aec7f605b270 100644
--- a/apps/meteor/ee/server/models/raw/LivechatTag.ts
+++ b/apps/meteor/ee/server/models/raw/LivechatTag.ts
@@ -1,9 +1,8 @@
import type { ILivechatTag } from '@rocket.chat/core-typings';
import type { ILivechatTagModel } from '@rocket.chat/model-typings';
+import { BaseRaw } from '@rocket.chat/models';
import type { Db, DeleteResult, FindCursor, FindOptions, IndexDescription } from 'mongodb';
-import { BaseRaw } from '../../../../server/models/raw/BaseRaw';
-
export class LivechatTagRaw extends BaseRaw implements ILivechatTagModel {
constructor(db: Db) {
super(db, 'livechat_tag');
diff --git a/apps/meteor/ee/server/models/raw/LivechatUnit.ts b/apps/meteor/ee/server/models/raw/LivechatUnit.ts
index c198ee04fbb0..3045d55c9006 100644
--- a/apps/meteor/ee/server/models/raw/LivechatUnit.ts
+++ b/apps/meteor/ee/server/models/raw/LivechatUnit.ts
@@ -1,9 +1,8 @@
import type { IOmnichannelBusinessUnit, ILivechatDepartment } from '@rocket.chat/core-typings';
import type { FindPaginated, ILivechatUnitModel } from '@rocket.chat/model-typings';
-import { LivechatUnitMonitors, LivechatDepartment, LivechatRooms } from '@rocket.chat/models';
+import { LivechatUnitMonitors, LivechatDepartment, LivechatRooms, BaseRaw } from '@rocket.chat/models';
import type { FindOptions, Filter, FindCursor, Db, FilterOperators, UpdateResult, DeleteResult, Document, UpdateFilter } from 'mongodb';
-import { BaseRaw } from '../../../../server/models/raw/BaseRaw';
import { getUnitsFromUser } from '../../../app/livechat-enterprise/server/lib/units';
const addQueryRestrictions = async (originalQuery: Filter = {}) => {
diff --git a/apps/meteor/ee/server/models/raw/LivechatUnitMonitors.ts b/apps/meteor/ee/server/models/raw/LivechatUnitMonitors.ts
index fcfed41c3382..f5545174ee60 100644
--- a/apps/meteor/ee/server/models/raw/LivechatUnitMonitors.ts
+++ b/apps/meteor/ee/server/models/raw/LivechatUnitMonitors.ts
@@ -1,9 +1,8 @@
import type { ILivechatUnitMonitor } from '@rocket.chat/core-typings';
import type { ILivechatUnitMonitorsModel } from '@rocket.chat/model-typings';
+import { BaseRaw } from '@rocket.chat/models';
import type { Db, FindCursor, UpdateResult, DeleteResult, IndexDescription } from 'mongodb';
-import { BaseRaw } from '../../../../server/models/raw/BaseRaw';
-
export class LivechatUnitMonitorsRaw extends BaseRaw implements ILivechatUnitMonitorsModel {
constructor(db: Db) {
super(db, 'livechat_unit_monitors');
diff --git a/apps/meteor/ee/server/models/raw/ReadReceipts.ts b/apps/meteor/ee/server/models/raw/ReadReceipts.ts
index cf0dd7283f31..f356016b49d3 100644
--- a/apps/meteor/ee/server/models/raw/ReadReceipts.ts
+++ b/apps/meteor/ee/server/models/raw/ReadReceipts.ts
@@ -1,9 +1,9 @@
import type { IUser, IMessage, ReadReceipt, RocketChatRecordDeleted } from '@rocket.chat/core-typings';
import type { IReadReceiptsModel } from '@rocket.chat/model-typings';
+import { BaseRaw } from '@rocket.chat/models';
import type { Collection, FindCursor, Db, IndexDescription, DeleteResult, Filter, UpdateResult, Document } from 'mongodb';
import { otrSystemMessages } from '../../../../app/otr/lib/constants';
-import { BaseRaw } from '../../../../server/models/raw/BaseRaw';
export class ReadReceiptsRaw extends BaseRaw implements IReadReceiptsModel {
constructor(db: Db, trash?: Collection>) {
diff --git a/apps/meteor/ee/server/models/raw/ServiceLevelAgreements.ts b/apps/meteor/ee/server/models/raw/ServiceLevelAgreements.ts
index ac34b6f82741..30f330b4710a 100644
--- a/apps/meteor/ee/server/models/raw/ServiceLevelAgreements.ts
+++ b/apps/meteor/ee/server/models/raw/ServiceLevelAgreements.ts
@@ -1,9 +1,8 @@
import type { IOmnichannelServiceLevelAgreements } from '@rocket.chat/core-typings';
import type { IOmnichannelServiceLevelAgreementsModel } from '@rocket.chat/model-typings/src';
+import { BaseRaw } from '@rocket.chat/models';
import type { Db, IndexDescription } from 'mongodb';
-import { BaseRaw } from '../../../../server/models/raw/BaseRaw';
-
export class ServiceLevelAgreements extends BaseRaw implements IOmnichannelServiceLevelAgreementsModel {
constructor(db: Db) {
super(db, 'omnichannel_service_level_agreements');
diff --git a/apps/meteor/ee/server/models/raw/Users.ts b/apps/meteor/ee/server/models/raw/Users.ts
index 20e6e0eb7962..9f2ae33019dd 100644
--- a/apps/meteor/ee/server/models/raw/Users.ts
+++ b/apps/meteor/ee/server/models/raw/Users.ts
@@ -1,8 +1,8 @@
import type { RocketChatRecordDeleted, IUser } from '@rocket.chat/core-typings';
+import { UsersRaw } from '@rocket.chat/models';
import type { Db, Collection } from 'mongodb';
import { readSecondaryPreferred } from '../../../../server/database/readSecondaryPreferred';
-import { UsersRaw } from '../../../../server/models/raw/Users';
type AgentMetadata = {
'agentId'?: string;
diff --git a/apps/meteor/server/database/trash.ts b/apps/meteor/server/database/trash.ts
index 18c7161a3dc8..be4caac9b60d 100644
--- a/apps/meteor/server/database/trash.ts
+++ b/apps/meteor/server/database/trash.ts
@@ -1,5 +1,6 @@
+import { TrashRaw } from '@rocket.chat/models';
+
import { db } from './utils';
-import { TrashRaw } from '../models/raw/Trash';
const Trash = new TrashRaw(db);
export const trashCollection = Trash.col;
From 67b491a2c9a4105ed624040c5c92bdf65a11b1ba Mon Sep 17 00:00:00 2001
From: Diego Sampaio
Date: Thu, 26 Dec 2024 11:54:47 -0300
Subject: [PATCH 08/14] fix typecheck
---
.../app/livechat/server/business-hour/AbstractBusinessHour.ts | 2 +-
.../server/hooks/messages/BeforeSaveCannedResponse.tests.ts | 3 +--
.../meteor/tests/unit/server/services/banner/service.tests.ts | 4 +---
apps/meteor/tests/unit/server/services/user/service.tests.ts | 4 +---
4 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/apps/meteor/app/livechat/server/business-hour/AbstractBusinessHour.ts b/apps/meteor/app/livechat/server/business-hour/AbstractBusinessHour.ts
index 9ddd273600d5..940954dfa2a7 100644
--- a/apps/meteor/app/livechat/server/business-hour/AbstractBusinessHour.ts
+++ b/apps/meteor/app/livechat/server/business-hour/AbstractBusinessHour.ts
@@ -1,10 +1,10 @@
import type { AtLeast, ILivechatAgentStatus, ILivechatBusinessHour, ILivechatDepartment } from '@rocket.chat/core-typings';
import type { ILivechatBusinessHoursModel, IUsersModel } from '@rocket.chat/model-typings';
import { LivechatBusinessHours, Users } from '@rocket.chat/models';
+import type { IWorkHoursCronJobsWrapper } from '@rocket.chat/models';
import moment from 'moment-timezone';
import type { UpdateFilter } from 'mongodb';
-import type { IWorkHoursCronJobsWrapper } from '../../../../server/models/raw/LivechatBusinessHours';
import { notifyOnUserChange } from '../../../lib/server/lib/notifyListener';
export interface IBusinessHourBehavior {
diff --git a/apps/meteor/ee/tests/unit/server/hooks/messages/BeforeSaveCannedResponse.tests.ts b/apps/meteor/ee/tests/unit/server/hooks/messages/BeforeSaveCannedResponse.tests.ts
index 56c4b7827940..9d2d2661dffe 100644
--- a/apps/meteor/ee/tests/unit/server/hooks/messages/BeforeSaveCannedResponse.tests.ts
+++ b/apps/meteor/ee/tests/unit/server/hooks/messages/BeforeSaveCannedResponse.tests.ts
@@ -1,9 +1,8 @@
-import { registerModel } from '@rocket.chat/models';
+import { registerModel, BaseRaw } from '@rocket.chat/models';
import { expect } from 'chai';
import { before, describe, it } from 'mocha';
import sinon from 'sinon';
-import { BaseRaw } from '../../../../../../server/models/raw/BaseRaw';
import { BeforeSaveCannedResponse } from '../../../../../server/hooks/messages/BeforeSaveCannedResponse';
const createMessage = (msg?: string, extra: any = {}) => ({
diff --git a/apps/meteor/tests/unit/server/services/banner/service.tests.ts b/apps/meteor/tests/unit/server/services/banner/service.tests.ts
index b1892ff849d1..b570f87365df 100644
--- a/apps/meteor/tests/unit/server/services/banner/service.tests.ts
+++ b/apps/meteor/tests/unit/server/services/banner/service.tests.ts
@@ -1,13 +1,11 @@
import type { BannerPlatform, IBanner, IBannerDismiss } from '@rocket.chat/core-typings';
-import { registerModel } from '@rocket.chat/models';
+import { registerModel, BaseRaw } from '@rocket.chat/models';
import { expect } from 'chai';
import { afterEach, before, describe, it } from 'mocha';
import type { FindCursor, FindOptions } from 'mongodb';
import proxyquire from 'proxyquire';
import sinon from 'sinon';
-import { BaseRaw } from '../../../../../server/models/raw/BaseRaw';
-
const { BannerService } = proxyquire.noCallThru().load('../../../../../server/services/banner/service', {});
class BannerModel extends BaseRaw {
diff --git a/apps/meteor/tests/unit/server/services/user/service.tests.ts b/apps/meteor/tests/unit/server/services/user/service.tests.ts
index b4b4d950673f..8c12af015d73 100644
--- a/apps/meteor/tests/unit/server/services/user/service.tests.ts
+++ b/apps/meteor/tests/unit/server/services/user/service.tests.ts
@@ -1,11 +1,9 @@
-import { registerModel } from '@rocket.chat/models';
+import { registerModel, BaseRaw } from '@rocket.chat/models';
import { expect } from 'chai';
import { afterEach, before, describe, it } from 'mocha';
import proxyquire from 'proxyquire';
import sinon from 'sinon';
-import { BaseRaw } from '../../../../../server/models/raw/BaseRaw';
-
const maxTokens = {
getMaxLoginTokens: () => 2,
};
From f916f63f94351a76e122d47d75aca754617af74f Mon Sep 17 00:00:00 2001
From: Diego Sampaio
Date: Thu, 26 Dec 2024 12:16:02 -0300
Subject: [PATCH 09/14] add missing deps to dockerfile
---
ee/apps/authorization-service/Dockerfile | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/ee/apps/authorization-service/Dockerfile b/ee/apps/authorization-service/Dockerfile
index de7b41913a20..18ad2653a631 100644
--- a/ee/apps/authorization-service/Dockerfile
+++ b/ee/apps/authorization-service/Dockerfile
@@ -47,6 +47,12 @@ COPY ./ee/packages/network-broker/dist ee/packages/network-broker/dist
COPY ./ee/packages/license/package.json packages/license/package.json
COPY ./ee/packages/license/dist packages/license/dist
+COPY ./packages/random/package.json packages/random/package.json
+COPY ./packages/random/dist packages/random/dist
+
+COPY ./packages/sha256/package.json packages/sha256/package.json
+COPY ./packages/sha256/dist packages/sha256/dist
+
COPY ./packages/tracing/package.json packages/tracing/package.json
COPY ./packages/tracing/dist packages/tracing/dist
From dc235c260a7c61681c10f9815a555ec253b4712a Mon Sep 17 00:00:00 2001
From: Diego Sampaio
Date: Thu, 26 Dec 2024 13:04:28 -0300
Subject: [PATCH 10/14] build sha256 as commonjs
---
packages/sha256/tsconfig.build.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/sha256/tsconfig.build.json b/packages/sha256/tsconfig.build.json
index 4a856a106b58..fb44f1fb1e59 100644
--- a/packages/sha256/tsconfig.build.json
+++ b/packages/sha256/tsconfig.build.json
@@ -2,7 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "ES2015",
- "module": "ESNext",
+ "module": "commonjs",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
From 79fb69280e774573d56ae2dd247c8f0d6648bd11 Mon Sep 17 00:00:00 2001
From: Diego Sampaio
Date: Thu, 26 Dec 2024 18:26:42 -0300
Subject: [PATCH 11/14] move missing model
---
apps/meteor/ee/server/models/LivechatPriority.ts | 6 ------
apps/meteor/ee/server/models/startup.ts | 1 -
apps/meteor/server/models.ts | 2 ++
packages/models/src/index.ts | 3 ++-
packages/models/src/modelClasses.ts | 1 +
.../raw => packages/models/src/models}/LivechatPriority.ts | 3 ++-
6 files changed, 7 insertions(+), 9 deletions(-)
delete mode 100644 apps/meteor/ee/server/models/LivechatPriority.ts
rename {apps/meteor/ee/server/models/raw => packages/models/src/models}/LivechatPriority.ts (97%)
diff --git a/apps/meteor/ee/server/models/LivechatPriority.ts b/apps/meteor/ee/server/models/LivechatPriority.ts
deleted file mode 100644
index c6d3b0ecf96a..000000000000
--- a/apps/meteor/ee/server/models/LivechatPriority.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { registerModel } from '@rocket.chat/models';
-
-import { LivechatPriorityRaw } from './raw/LivechatPriority';
-import { db } from '../../../server/database/utils';
-
-registerModel('ILivechatPriorityModel', new LivechatPriorityRaw(db));
diff --git a/apps/meteor/ee/server/models/startup.ts b/apps/meteor/ee/server/models/startup.ts
index f77bcd1d7619..b558c95b4639 100644
--- a/apps/meteor/ee/server/models/startup.ts
+++ b/apps/meteor/ee/server/models/startup.ts
@@ -3,7 +3,6 @@ import { License } from '@rocket.chat/license';
// To facilitate our lives with the stream
// Collection will be registered on CE too
// No functionality will be imported tho, just the service registration
-import('./LivechatPriority');
import('./OmnichannelServiceLevelAgreements');
import('./AuditLog');
import('./ReadReceipts');
diff --git a/apps/meteor/server/models.ts b/apps/meteor/server/models.ts
index 154d31f3444b..b712a0ed5895 100644
--- a/apps/meteor/server/models.ts
+++ b/apps/meteor/server/models.ts
@@ -33,6 +33,7 @@ import {
LivechatDepartmentAgentsRaw,
LivechatDepartmentRaw,
LivechatInquiryRaw,
+ LivechatPriorityRaw,
LivechatRoomsRaw,
LivechatTriggerRaw,
LivechatVisitorsRaw,
@@ -121,6 +122,7 @@ registerModel(
new LivechatInquiryRaw(db, trashCollection as Collection>),
);
registerModel('ILivechatRoomsModel', new LivechatRoomsRaw(db, trashCollection));
+registerModel('ILivechatPriorityModel', new LivechatPriorityRaw(db));
registerModel('ILivechatTriggerModel', new LivechatTriggerRaw(db));
registerModel('ILivechatVisitorsModel', new LivechatVisitorsRaw(db));
registerModel('ILoginServiceConfigurationModel', new LoginServiceConfigurationRaw(db));
diff --git a/packages/models/src/index.ts b/packages/models/src/index.ts
index 71bcdc528967..d8f8c67ad3b2 100644
--- a/packages/models/src/index.ts
+++ b/packages/models/src/index.ts
@@ -105,6 +105,7 @@ import {
EmailInboxRaw,
PbxEventsRaw,
LivechatRoomsRaw,
+ LivechatPriorityRaw,
UploadsRaw,
LivechatVisitorsRaw,
RolesRaw,
@@ -244,7 +245,7 @@ export function registerServiceModels(db: Db, trash?: Collection new IntegrationsRaw(db));
registerModel('IEmailInboxModel', () => new EmailInboxRaw(db));
registerModel('IPbxEventsModel', () => new PbxEventsRaw(db));
- // registerModel('ILivechatPriorityModel', new LivechatPriorityRaw(db));
+ registerModel('ILivechatPriorityModel', new LivechatPriorityRaw(db));
registerModel('ILivechatRoomsModel', () => new LivechatRoomsRaw(db));
registerModel('IUploadsModel', () => new UploadsRaw(db));
registerModel('ILivechatVisitorsModel', () => new LivechatVisitorsRaw(db));
diff --git a/packages/models/src/modelClasses.ts b/packages/models/src/modelClasses.ts
index 9bf8582fe213..2a7e3ce8e665 100644
--- a/packages/models/src/modelClasses.ts
+++ b/packages/models/src/modelClasses.ts
@@ -30,6 +30,7 @@ export * from './models/LivechatCustomField';
export * from './models/LivechatDepartment';
export * from './models/LivechatDepartmentAgents';
export * from './models/LivechatInquiry';
+export * from './models/LivechatPriority';
export * from './models/LivechatRooms';
export * from './models/LivechatTrigger';
export * from './models/LivechatVisitors';
diff --git a/apps/meteor/ee/server/models/raw/LivechatPriority.ts b/packages/models/src/models/LivechatPriority.ts
similarity index 97%
rename from apps/meteor/ee/server/models/raw/LivechatPriority.ts
rename to packages/models/src/models/LivechatPriority.ts
index ae8bdfd81d55..d7a8d172e518 100644
--- a/apps/meteor/ee/server/models/raw/LivechatPriority.ts
+++ b/packages/models/src/models/LivechatPriority.ts
@@ -1,9 +1,10 @@
import type { ILivechatPriority } from '@rocket.chat/core-typings';
import type { ILivechatPriorityModel } from '@rocket.chat/model-typings';
-import { BaseRaw } from '@rocket.chat/models';
import { escapeRegExp } from '@rocket.chat/string-helpers';
import type { Db, UpdateFilter, ModifyResult, IndexDescription, FindCursor } from 'mongodb';
+import { BaseRaw } from './BaseRaw';
+
// TODO need to define type for LivechatPriority object
export class LivechatPriorityRaw extends BaseRaw implements ILivechatPriorityModel {
constructor(db: Db) {
From 71fa3a01fbcfb914734a14087d3da1e95b1e05fc Mon Sep 17 00:00:00 2001
From: Diego Sampaio
Date: Thu, 26 Dec 2024 19:23:41 -0300
Subject: [PATCH 12/14] add logger package to services
---
README.md | 31 +++++++++++++++-------
ee/apps/account-service/package.json | 1 +
ee/apps/authorization-service/package.json | 1 +
ee/apps/presence-service/package.json | 1 +
yarn.lock | 3 +++
5 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index d4053587a5c7..c6e7d2813ab2 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+
@@ -13,8 +13,6 @@
-
-
[Rocket.Chat](https://rocket.chat) is an open-source fully customizable communications platform developed in JavaScript for organizations with high standards of data protection.
We are the ultimate **Free Open Source Solution** for team communications, enabling real-time conversations between colleagues, with other companies or with your customers, regardless of how they connect with you. The result is an increase in productivity and customer satisfaction rates.
@@ -23,7 +21,7 @@ Every day, tens of millions of users in over 150 countries and in organizations
# 🚀 Product Offerings - Self Hosted and Cloud
-Rocket.Chat has four key product offerings:
+Rocket.Chat has four key product offerings:
💬 **Team collaboration** - A single point for secure internal and cross-company collaboration.
@@ -45,7 +43,7 @@ Free for 30 days. Afterward, choose between continuing to host on our secure clo
# 🛠️ Local development
-## Prerequisites
+## Prerequisites
You can follow these instructions to setup a dev environment:
@@ -56,12 +54,14 @@ You can follow these instructions to setup a dev environment:
- Clone this repo: `git clone https://github.com/RocketChat/Rocket.Chat.git`
- Run `yarn` to install dependencies
-**Starting Rocket.Chat:**
+### Starting Rocket.Chat
```bash
yarn dev # run all packages
```
+
OR
+
```bash
yarn dsv # run only meteor (front and back) with pre-built packages
```
@@ -71,6 +71,20 @@ After initialized, you can access the server at http://localhost:3000
More details at: [Developer Docs](https://developer.rocket.chat/v1/docs/server-environment-setup)
PS: For Windows you MUST use WSL2 and have +12Gb RAM
+### Run tests like on CI
+
+```bash
+cd ./apps/meteor
+meteor build --server-only --directory /tmp/build
+cd ../../
+DENO_VERSION=1.37.1 \
+RC_DOCKERFILE=Dockerfile \
+LOWERCASE_REPOSITORY=rocket.chat \
+RC_DOCKER_TAG=develop \
+DOCKER_TAG=develop \
+ENTERPRISE_LICENSE="" \
+docker compose -f ./.github/docker-compose.yml up
+```
# Gitpod Setup
@@ -99,10 +113,9 @@ Please refer to [Install Rocket.Chat](https://rocket.chat/install) to install yo
In addition to the web interface, you can also download Rocket.Chat clients for:
-
[![Rocket.Chat on Apple App Store](https://user-images.githubusercontent.com/551004/29770691-a2082ff4-8bc6-11e7-89a6-964cd405ea8e.png)](https://itunes.apple.com/us/app/rocket-chat/id1148741252?mt=8) [![Rocket.Chat on Google Play](https://user-images.githubusercontent.com/551004/29770692-a20975c6-8bc6-11e7-8ab0-1cde275496e0.png)](https://play.google.com/store/apps/details?id=chat.rocket.android) [![](https://user-images.githubusercontent.com/551004/48210349-50649480-e35e-11e8-97d9-74a4331faf3a.png)](https://f-droid.org/en/packages/chat.rocket.android)
-You can also contribute to the Mobile open source code in [Rocket.Chat.ReactNative](https://github.com/RocketChat/Rocket.Chat.ReactNative) and check it out its [documentation](https://developer.rocket.chat/mobile-app/mobile-app-environment-setup)
+You can also contribute to the Mobile open source code in [Rocket.Chat.ReactNative](https://github.com/RocketChat/Rocket.Chat.ReactNative) and check it out its [documentation](https://developer.rocket.chat/mobile-app/mobile-app-environment-setup)
# 🧩 Apps Engine for Rocket.Chat
@@ -125,12 +138,10 @@ You can develop your own app that can be integrated with Rocket.Chat. We provide
Join thousands of members worldwide in our [community server](https://open.rocket.chat).
Join [#support](https://open.rocket.chat/channel/support) and [#general](https://open.rocket.chat/channel/general) for help from the community.
-
# 👥 Contributions
Rocket.Chat is an open source project and we are very happy to accept community contributions. Please refer to the [How can I help?](https://developer.rocket.chat/contribute-to-rocket.chat/ways-to-contribute) page for more details.
-
## 💼 Become a Rocketeer
We're hiring developers, support people, and product managers all the time. Please check our [jobs page](https://rocket.chat/jobs).
diff --git a/ee/apps/account-service/package.json b/ee/apps/account-service/package.json
index da2122998c23..35b7bd119516 100644
--- a/ee/apps/account-service/package.json
+++ b/ee/apps/account-service/package.json
@@ -18,6 +18,7 @@
"@rocket.chat/core-services": "workspace:^",
"@rocket.chat/core-typings": "workspace:^",
"@rocket.chat/emitter": "~0.31.25",
+ "@rocket.chat/logger": "workspace:^",
"@rocket.chat/model-typings": "workspace:^",
"@rocket.chat/models": "workspace:^",
"@rocket.chat/network-broker": "workspace:^",
diff --git a/ee/apps/authorization-service/package.json b/ee/apps/authorization-service/package.json
index 83719a245bf5..40fd480b0a0f 100644
--- a/ee/apps/authorization-service/package.json
+++ b/ee/apps/authorization-service/package.json
@@ -18,6 +18,7 @@
"@rocket.chat/core-services": "workspace:^",
"@rocket.chat/core-typings": "workspace:^",
"@rocket.chat/emitter": "~0.31.25",
+ "@rocket.chat/logger": "workspace:^",
"@rocket.chat/model-typings": "workspace:^",
"@rocket.chat/models": "workspace:^",
"@rocket.chat/network-broker": "workspace:^",
diff --git a/ee/apps/presence-service/package.json b/ee/apps/presence-service/package.json
index de78e2bd8275..091b1ed03aa4 100644
--- a/ee/apps/presence-service/package.json
+++ b/ee/apps/presence-service/package.json
@@ -18,6 +18,7 @@
"@rocket.chat/core-services": "workspace:^",
"@rocket.chat/core-typings": "workspace:^",
"@rocket.chat/emitter": "~0.31.25",
+ "@rocket.chat/logger": "workspace:^",
"@rocket.chat/model-typings": "workspace:^",
"@rocket.chat/models": "workspace:^",
"@rocket.chat/network-broker": "workspace:^",
diff --git a/yarn.lock b/yarn.lock
index 3f7587292153..a3756b75550c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -8269,6 +8269,7 @@ __metadata:
"@rocket.chat/core-typings": "workspace:^"
"@rocket.chat/emitter": "npm:~0.31.25"
"@rocket.chat/eslint-config": "workspace:^"
+ "@rocket.chat/logger": "workspace:^"
"@rocket.chat/model-typings": "workspace:^"
"@rocket.chat/models": "workspace:^"
"@rocket.chat/network-broker": "workspace:^"
@@ -8404,6 +8405,7 @@ __metadata:
"@rocket.chat/core-typings": "workspace:^"
"@rocket.chat/emitter": "npm:~0.31.25"
"@rocket.chat/eslint-config": "workspace:^"
+ "@rocket.chat/logger": "workspace:^"
"@rocket.chat/model-typings": "workspace:^"
"@rocket.chat/models": "workspace:^"
"@rocket.chat/network-broker": "workspace:^"
@@ -9785,6 +9787,7 @@ __metadata:
"@rocket.chat/core-typings": "workspace:^"
"@rocket.chat/emitter": "npm:~0.31.25"
"@rocket.chat/eslint-config": "workspace:^"
+ "@rocket.chat/logger": "workspace:^"
"@rocket.chat/model-typings": "workspace:^"
"@rocket.chat/models": "workspace:^"
"@rocket.chat/network-broker": "workspace:^"
From 9f0c4b87cc1e86ffe6ebaf60d2af1f8fa967e8a2 Mon Sep 17 00:00:00 2001
From: Diego Sampaio
Date: Thu, 26 Dec 2024 19:57:51 -0300
Subject: [PATCH 13/14] tsc output to same app dir structure
---
ee/apps/account-service/tsconfig.json | 2 +-
ee/apps/omnichannel-transcript/tsconfig.json | 2 +-
ee/apps/presence-service/tsconfig.json | 2 +-
ee/apps/queue-worker/tsconfig.json | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/ee/apps/account-service/tsconfig.json b/ee/apps/account-service/tsconfig.json
index 032878e7b4b8..85c682540991 100644
--- a/ee/apps/account-service/tsconfig.json
+++ b/ee/apps/account-service/tsconfig.json
@@ -12,7 +12,7 @@
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": false,
- "outDir": "./dist"
+ "outDir": "./dist/ee/apps/account-service/src",
},
"files": ["./src/service.ts"],
"include": ["../../../apps/meteor/definition/externals/meteor"],
diff --git a/ee/apps/omnichannel-transcript/tsconfig.json b/ee/apps/omnichannel-transcript/tsconfig.json
index 58ffe2a53b03..d98107bf9f70 100644
--- a/ee/apps/omnichannel-transcript/tsconfig.json
+++ b/ee/apps/omnichannel-transcript/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"allowJs": true,
"strictPropertyInitialization": false,
- "outDir": "./dist",
+ "outDir": "./dist/ee/apps/omnichannel-transcript/src",
},
"files": ["./src/service.ts"],
"include": ["../../../apps/meteor/definition/externals/meteor"],
diff --git a/ee/apps/presence-service/tsconfig.json b/ee/apps/presence-service/tsconfig.json
index 7c09cdc08940..e5999ba7d1bc 100644
--- a/ee/apps/presence-service/tsconfig.json
+++ b/ee/apps/presence-service/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"strictPropertyInitialization": false, // TODO: Remove this line
"allowJs": true, // TODO: Remove this line
- "outDir": "./dist"
+ "outDir": "./dist/ee/apps/presence-service/src",
},
"files": ["./src/service.ts"],
"include": ["../../../apps/meteor/definition/externals/meteor"],
diff --git a/ee/apps/queue-worker/tsconfig.json b/ee/apps/queue-worker/tsconfig.json
index 58ffe2a53b03..ac2fff501da3 100644
--- a/ee/apps/queue-worker/tsconfig.json
+++ b/ee/apps/queue-worker/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"allowJs": true,
"strictPropertyInitialization": false,
- "outDir": "./dist",
+ "outDir": "./dist/ee/apps/queue-worker/src",
},
"files": ["./src/service.ts"],
"include": ["../../../apps/meteor/definition/externals/meteor"],
From 36da85cf0ed0b1b1f164a8b06304b62b8c6b5c53 Mon Sep 17 00:00:00 2001
From: Diego Sampaio
Date: Thu, 26 Dec 2024 21:44:23 -0300
Subject: [PATCH 14/14] revert README
---
README.md | 31 ++++++++++---------------------
1 file changed, 10 insertions(+), 21 deletions(-)
diff --git a/README.md b/README.md
index c6e7d2813ab2..d4053587a5c7 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+
@@ -13,6 +13,8 @@
+
+
[Rocket.Chat](https://rocket.chat) is an open-source fully customizable communications platform developed in JavaScript for organizations with high standards of data protection.
We are the ultimate **Free Open Source Solution** for team communications, enabling real-time conversations between colleagues, with other companies or with your customers, regardless of how they connect with you. The result is an increase in productivity and customer satisfaction rates.
@@ -21,7 +23,7 @@ Every day, tens of millions of users in over 150 countries and in organizations
# 🚀 Product Offerings - Self Hosted and Cloud
-Rocket.Chat has four key product offerings:
+Rocket.Chat has four key product offerings:
💬 **Team collaboration** - A single point for secure internal and cross-company collaboration.
@@ -43,7 +45,7 @@ Free for 30 days. Afterward, choose between continuing to host on our secure clo
# 🛠️ Local development
-## Prerequisites
+## Prerequisites
You can follow these instructions to setup a dev environment:
@@ -54,14 +56,12 @@ You can follow these instructions to setup a dev environment:
- Clone this repo: `git clone https://github.com/RocketChat/Rocket.Chat.git`
- Run `yarn` to install dependencies
-### Starting Rocket.Chat
+**Starting Rocket.Chat:**
```bash
yarn dev # run all packages
```
-
OR
-
```bash
yarn dsv # run only meteor (front and back) with pre-built packages
```
@@ -71,20 +71,6 @@ After initialized, you can access the server at http://localhost:3000
More details at: [Developer Docs](https://developer.rocket.chat/v1/docs/server-environment-setup)
PS: For Windows you MUST use WSL2 and have +12Gb RAM
-### Run tests like on CI
-
-```bash
-cd ./apps/meteor
-meteor build --server-only --directory /tmp/build
-cd ../../
-DENO_VERSION=1.37.1 \
-RC_DOCKERFILE=Dockerfile \
-LOWERCASE_REPOSITORY=rocket.chat \
-RC_DOCKER_TAG=develop \
-DOCKER_TAG=develop \
-ENTERPRISE_LICENSE="" \
-docker compose -f ./.github/docker-compose.yml up
-```
# Gitpod Setup
@@ -113,9 +99,10 @@ Please refer to [Install Rocket.Chat](https://rocket.chat/install) to install yo
In addition to the web interface, you can also download Rocket.Chat clients for:
+
[![Rocket.Chat on Apple App Store](https://user-images.githubusercontent.com/551004/29770691-a2082ff4-8bc6-11e7-89a6-964cd405ea8e.png)](https://itunes.apple.com/us/app/rocket-chat/id1148741252?mt=8) [![Rocket.Chat on Google Play](https://user-images.githubusercontent.com/551004/29770692-a20975c6-8bc6-11e7-8ab0-1cde275496e0.png)](https://play.google.com/store/apps/details?id=chat.rocket.android) [![](https://user-images.githubusercontent.com/551004/48210349-50649480-e35e-11e8-97d9-74a4331faf3a.png)](https://f-droid.org/en/packages/chat.rocket.android)
-You can also contribute to the Mobile open source code in [Rocket.Chat.ReactNative](https://github.com/RocketChat/Rocket.Chat.ReactNative) and check it out its [documentation](https://developer.rocket.chat/mobile-app/mobile-app-environment-setup)
+You can also contribute to the Mobile open source code in [Rocket.Chat.ReactNative](https://github.com/RocketChat/Rocket.Chat.ReactNative) and check it out its [documentation](https://developer.rocket.chat/mobile-app/mobile-app-environment-setup)
# 🧩 Apps Engine for Rocket.Chat
@@ -138,10 +125,12 @@ You can develop your own app that can be integrated with Rocket.Chat. We provide
Join thousands of members worldwide in our [community server](https://open.rocket.chat).
Join [#support](https://open.rocket.chat/channel/support) and [#general](https://open.rocket.chat/channel/general) for help from the community.
+
# 👥 Contributions
Rocket.Chat is an open source project and we are very happy to accept community contributions. Please refer to the [How can I help?](https://developer.rocket.chat/contribute-to-rocket.chat/ways-to-contribute) page for more details.
+
## 💼 Become a Rocketeer
We're hiring developers, support people, and product managers all the time. Please check our [jobs page](https://rocket.chat/jobs).