From dca9066f19708caeca071a439c2d642a9510207c Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Tue, 26 Jul 2022 13:41:02 +0800 Subject: [PATCH] Continue fix RLS issue of updating user table --- packages/api/src/routers/auth/auth_router.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/api/src/routers/auth/auth_router.ts b/packages/api/src/routers/auth/auth_router.ts index 93a6c03d2..ad19c9b1e 100644 --- a/packages/api/src/routers/auth/auth_router.ts +++ b/packages/api/src/routers/auth/auth_router.ts @@ -506,10 +506,9 @@ export function authRouter() { const updated = await AppDataSource.transaction( async (entityManager) => { await setClaims(entityManager, user.id) - return getRepository(User).update( - { id: user.id }, - { status: StatusType.Active } - ) + return entityManager + .getRepository(User) + .update({ id: user.id }, { status: StatusType.Active }) } ) @@ -626,10 +625,9 @@ export function authRouter() { const updated = await AppDataSource.transaction( async (entityManager) => { await setClaims(entityManager, user.id) - return getRepository(User).update( - { id: user.id }, - { password: hashedPassword } - ) + return entityManager + .getRepository(User) + .update({ id: user.id }, { password: hashedPassword }) } ) if (!updated.affected) {