Browse Source

fix: ensure user exist and add missing await

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2393/head
Pranav C 2 years ago
parent
commit
e76daa8f81
  1. 4
      packages/nocodb/src/lib/meta/api/userApi/initAdminFromEnv.ts

4
packages/nocodb/src/lib/meta/api/userApi/initAdminFromEnv.ts

@ -103,7 +103,7 @@ export default async function initAdminFromEnv(_ncMeta = Noco.ncMeta) {
// check user account already present with the new admin email
const existingUserWithNewEmail = await User.getByEmail(email, ncMeta);
if (existingUserWithNewEmail) {
if (existingUserWithNewEmail?.id) {
// get all project access belongs to the existing account
// and migrate to the admin account
const existingUserProjects = await ncMeta.metaList2(
@ -155,7 +155,7 @@ export default async function initAdminFromEnv(_ncMeta = Noco.ncMeta) {
}
// delete existing user
ncMeta.metaDelete(
await ncMeta.metaDelete(
null,
null,
MetaTable.USERS,

Loading…
Cancel
Save