@@ -42,6 +42,7 @@ import { UserCacheServiceInterface } from './usercache.service.interface';
4242import { DUPLICATE_ERROR_CODE } from '../../constants/db.error.constants' ;
4343import { LoggerService } from '../../logger/logger.service' ;
4444import { ExecutionManager } from '../../util/execution.manager' ;
45+ import { getConnection } from '../../util/database.connection' ;
4546
4647@Injectable ( )
4748export class GroupService implements GroupServiceInterface {
@@ -74,7 +75,7 @@ export class GroupService implements GroupServiceInterface {
7475 [ 'name' , 'group.name' ] ,
7576 [ 'updatedAt' , 'group.updated_at' ] ,
7677 ] ) ;
77- let queryBuilder = this . groupRepository . createQueryBuilder ( 'group' ) ;
78+ let queryBuilder = await this . groupRepository . getQueryBuilder ( 'group' ) ;
7879
7980 if ( input ?. search ) {
8081 queryBuilder = this . searchService . generateSearchTermForEntity (
@@ -170,7 +171,7 @@ export class GroupService implements GroupServiceInterface {
170171 throw new GroupDeleteNotAllowedException ( ) ;
171172 }
172173
173- await this . dataSource . manager . transaction ( async ( entityManager ) => {
174+ await ( await getConnection ( ) ) . manager . transaction ( async ( entityManager ) => {
174175 const groupRepo = entityManager . getRepository ( Group ) ;
175176 const groupRoleRepo = entityManager . getRepository ( GroupRole ) ;
176177 const groupPermissionRepo = entityManager . getRepository ( GroupPermission ) ;
@@ -222,7 +223,7 @@ export class GroupService implements GroupServiceInterface {
222223 } ) ) ,
223224 ) ;
224225
225- await this . dataSource . manager . transaction ( async ( entityManager ) => {
226+ await ( await getConnection ( ) ) . manager . transaction ( async ( entityManager ) => {
226227 const groupPermissionsRepo = entityManager . getRepository ( GroupPermission ) ;
227228 await groupPermissionsRepo . remove ( permissionsToBeRemovedFromGroup ) ;
228229 await groupPermissionsRepo . save ( groupPermission ) ;
@@ -251,7 +252,7 @@ export class GroupService implements GroupServiceInterface {
251252 userIds . map ( ( userId ) => ( { userId : userId , groupId : id } ) ) ,
252253 ) ;
253254
254- await this . dataSource . manager . transaction ( async ( entityManager ) => {
255+ await ( await getConnection ( ) ) . manager . transaction ( async ( entityManager ) => {
255256 const userGroupsRepo = entityManager . getRepository ( UserGroup ) ;
256257 await userGroupsRepo . remove ( usersToBeRemovedFromGroup ) ;
257258 await userGroupsRepo . save ( userGroups ) ;
@@ -321,7 +322,7 @@ export class GroupService implements GroupServiceInterface {
321322 } ) ) ,
322323 ) ;
323324
324- await this . dataSource . manager . transaction ( async ( entityManager ) => {
325+ await ( await getConnection ( ) ) . manager . transaction ( async ( entityManager ) => {
325326 const groupRolesRepo = entityManager . getRepository ( GroupRole ) ;
326327 await groupRolesRepo . remove ( rolesToBeRemovedFromGroup ) ;
327328 await groupRolesRepo . save ( groupRoles ) ;
0 commit comments