Deprecate workspace datasoure (#16507)

This commit is contained in:
Weiko
2025-12-11 18:27:49 +01:00
committed by GitHub
parent 3dd2684254
commit 083a038f8a
39 changed files with 200 additions and 1929 deletions
@@ -142,9 +142,7 @@ export class MessagingMessageCleanerService {
);
const workspaceDataSource =
await this.globalWorkspaceOrmManager.getDataSourceForWorkspace(
workspaceId,
);
await this.globalWorkspaceOrmManager.getGlobalWorkspaceDataSource();
await workspaceDataSource.transaction(
async (transactionManager: WorkspaceEntityManager) => {
@@ -198,7 +198,7 @@ describe('MessagingMessageListFetchService', () => {
{
provide: GlobalWorkspaceOrmManager,
useValue: {
getDataSourceForWorkspace: jest.fn().mockResolvedValue({
getGlobalWorkspaceDataSource: jest.fn().mockResolvedValue({
manager: {},
}),
executeInWorkspaceContext: jest
@@ -206,6 +206,11 @@ describe('MessagingMessageListFetchService', () => {
.mockImplementation((_authContext: any, fn: () => any) => fn()),
getRepository: jest.fn().mockImplementation((workspaceId, name) => {
if (name === 'messageChannel') {
return {
findOne: jest.fn().mockResolvedValue(undefined),
};
}
if (name === 'messageChannelMessageAssociation') {
return mockMessageChannelMessageAssociationRepository;
}
@@ -128,9 +128,7 @@ export class MessagingMessageListFetchService {
};
const datasource =
await this.globalWorkspaceOrmManager.getDataSourceForWorkspace(
workspaceId,
);
await this.globalWorkspaceOrmManager.getGlobalWorkspaceDataSource();
await this.syncMessageFoldersService.syncMessageFolders({
workspaceId,
@@ -93,9 +93,7 @@ export class MessagingProcessFolderActionsService {
authContext,
async () => {
const workspaceDataSource =
await this.globalWorkspaceOrmManager.getDataSourceForWorkspace(
workspaceId,
);
await this.globalWorkspaceOrmManager.getGlobalWorkspaceDataSource();
await workspaceDataSource?.transaction(
async (transactionManager: WorkspaceEntityManager) => {
@@ -74,9 +74,7 @@ export class MessagingProcessGroupEmailActionsService {
authContext,
async () => {
const workspaceDataSource =
await this.globalWorkspaceOrmManager.getDataSourceForWorkspace(
workspaceId,
);
await this.globalWorkspaceOrmManager.getGlobalWorkspaceDataSource();
await workspaceDataSource?.transaction(
async (transactionManager: WorkspaceEntityManager) => {
@@ -154,7 +154,7 @@ describe('MessagingSaveMessagesAndEnqueueContactCreationService', () => {
{
provide: GlobalWorkspaceOrmManager,
useValue: {
getDataSourceForWorkspace: jest
getGlobalWorkspaceDataSource: jest
.fn()
.mockResolvedValue(datasourceInstance),
executeInWorkspaceContext: jest
@@ -50,9 +50,7 @@ export class MessagingSaveMessagesAndEnqueueContactCreationService {
authContext,
async () => {
const workspaceDataSource =
await this.globalWorkspaceOrmManager.getDataSourceForWorkspace(
workspaceId,
);
await this.globalWorkspaceOrmManager.getGlobalWorkspaceDataSource();
return workspaceDataSource?.transaction(
async (transactionManager: WorkspaceEntityManager) => {