Skip to content

Commit 29168b2

Browse files
committed
FIX: use dynamic connection for user permission updation
1 parent 93da280 commit 29168b2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/authorization/repository/base.repository.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
SelectQueryBuilder,
77
QueryRunner,
88
SaveOptions,
9-
DeepPartial,
9+
RemoveOptions,
1010
} from 'typeorm';
1111
import { getConnection } from '../../util/database.connection';
1212

@@ -75,4 +75,9 @@ export class BaseRepository<T extends ObjectLiteral> extends Repository<T> {
7575
const repository = await this.getDynamicRepository();
7676
return repository.save(entity, options);
7777
}
78+
79+
async remove(entity: any, options?: RemoveOptions): Promise<any> {
80+
const repository = await this.getDynamicRepository();
81+
return repository.remove(entity, options);
82+
}
7883
}

src/authorization/service/user.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export class UserService implements UserServiceInterface {
202202
})),
203203
);
204204

205-
const userPermissionsUpdated = await this.dataSource.transaction(
205+
const userPermissionsUpdated = await (await getConnection()).transaction(
206206
async (entityManager) => {
207207
const userPermissionsRepo = entityManager.getRepository(UserPermission);
208208
await userPermissionsRepo.remove(userPermissionsToBeRemoved);

0 commit comments

Comments
 (0)