Deprecate workspace datasoure (#16507)
This commit is contained in:
+1
-3
@@ -142,9 +142,7 @@ export class MessagingMessageCleanerService {
|
||||
);
|
||||
|
||||
const workspaceDataSource =
|
||||
await this.globalWorkspaceOrmManager.getDataSourceForWorkspace(
|
||||
workspaceId,
|
||||
);
|
||||
await this.globalWorkspaceOrmManager.getGlobalWorkspaceDataSource();
|
||||
|
||||
await workspaceDataSource.transaction(
|
||||
async (transactionManager: WorkspaceEntityManager) => {
|
||||
|
||||
+6
-1
@@ -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;
|
||||
}
|
||||
|
||||
+1
-3
@@ -128,9 +128,7 @@ export class MessagingMessageListFetchService {
|
||||
};
|
||||
|
||||
const datasource =
|
||||
await this.globalWorkspaceOrmManager.getDataSourceForWorkspace(
|
||||
workspaceId,
|
||||
);
|
||||
await this.globalWorkspaceOrmManager.getGlobalWorkspaceDataSource();
|
||||
|
||||
await this.syncMessageFoldersService.syncMessageFolders({
|
||||
workspaceId,
|
||||
|
||||
+1
-3
@@ -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) => {
|
||||
|
||||
+1
-3
@@ -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) => {
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ describe('MessagingSaveMessagesAndEnqueueContactCreationService', () => {
|
||||
{
|
||||
provide: GlobalWorkspaceOrmManager,
|
||||
useValue: {
|
||||
getDataSourceForWorkspace: jest
|
||||
getGlobalWorkspaceDataSource: jest
|
||||
.fn()
|
||||
.mockResolvedValue(datasourceInstance),
|
||||
executeInWorkspaceContext: jest
|
||||
|
||||
+1
-3
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user