From 7f9f8ef4a50a057b8ddede9ad5079584e8ead9a5 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Mon, 7 Oct 2024 13:16:04 +0530 Subject: [PATCH] refactor: add null check Signed-off-by: Pranav C --- .../nocodb/src/services/base-users/base-users.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nocodb/src/services/base-users/base-users.service.ts b/packages/nocodb/src/services/base-users/base-users.service.ts index aaec7d8caf..cfece00ceb 100644 --- a/packages/nocodb/src/services/base-users/base-users.service.ts +++ b/packages/nocodb/src/services/base-users/base-users.service.ts @@ -114,13 +114,13 @@ export class BaseUsersService { } // if already exists and has a role then throw error - if (baseUser.is_mapped && baseUser?.roles) { + if (baseUser?.is_mapped && baseUser?.roles) { NcError.badRequest( `${user.email} with role ${baseUser.roles} already exists in this base`, ); } // if user exist and role is not assigned then assign role by updating base user - else if (baseUser.is_mapped) { + else if (baseUser?.is_mapped) { await BaseUser.updateRoles( context, param.baseId, @@ -472,7 +472,7 @@ export class BaseUsersService { if (Object.keys(baseUserData).length) { // create new base user if it doesn't exist if ( - !(await BaseUser.get(context, param.baseId, param.user?.id)).is_mapped + !(await BaseUser.get(context, param.baseId, param.user?.id))?.is_mapped ) { await BaseUser.insert(context, { ...baseUserData,