Fix seeding perf + batch role targets creation (#16337)
This commit is contained in:
+6
-4
@@ -110,7 +110,7 @@ describe('UserWorkspaceService', () => {
|
||||
{
|
||||
provide: UserRoleService,
|
||||
useValue: {
|
||||
assignRoleToUserWorkspace: jest.fn(),
|
||||
assignRoleToManyUserWorkspace: jest.fn(),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -417,7 +417,7 @@ describe('UserWorkspaceService', () => {
|
||||
jest.spyOn(service, 'create').mockResolvedValue(userWorkspace);
|
||||
jest.spyOn(service, 'createWorkspaceMember').mockResolvedValue(undefined);
|
||||
jest
|
||||
.spyOn(userRoleService, 'assignRoleToUserWorkspace')
|
||||
.spyOn(userRoleService, 'assignRoleToManyUserWorkspace')
|
||||
.mockResolvedValue(undefined);
|
||||
jest
|
||||
.spyOn(workspaceInvitationService, 'invalidateWorkspaceInvitation')
|
||||
@@ -439,9 +439,11 @@ describe('UserWorkspaceService', () => {
|
||||
workspace.id,
|
||||
user,
|
||||
);
|
||||
expect(userRoleService.assignRoleToUserWorkspace).toHaveBeenCalledWith({
|
||||
expect(
|
||||
userRoleService.assignRoleToManyUserWorkspace,
|
||||
).toHaveBeenCalledWith({
|
||||
workspaceId: workspace.id,
|
||||
userWorkspaceId: userWorkspace.id,
|
||||
userWorkspaceIds: [userWorkspace.id],
|
||||
roleId: workspace.defaultRoleId,
|
||||
});
|
||||
expect(
|
||||
|
||||
+2
-2
@@ -157,9 +157,9 @@ export class UserWorkspaceService extends TypeOrmQueryService<UserWorkspaceEntit
|
||||
);
|
||||
}
|
||||
|
||||
await this.userRoleService.assignRoleToUserWorkspace({
|
||||
await this.userRoleService.assignRoleToManyUserWorkspace({
|
||||
workspaceId: workspace.id,
|
||||
userWorkspaceId: userWorkspace.id,
|
||||
userWorkspaceIds: [userWorkspace.id],
|
||||
roleId: defaultRoleId,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user