From c07281639c7197a111dba967b74deb8dcca6a619 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 25 Jul 2022 17:18:42 +0100 Subject: [PATCH] fix builder assignment issue --- packages/worker/src/sdk/users/users.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/worker/src/sdk/users/users.ts b/packages/worker/src/sdk/users/users.ts index 893de0c2fc..b908c2f88e 100644 --- a/packages/worker/src/sdk/users/users.ts +++ b/packages/worker/src/sdk/users/users.ts @@ -100,7 +100,6 @@ export const buildUser = async ( opts: SaveUserOpts = { hashPassword: true, requirePassword: true, - bulkCreate: false, }, tenantId: string, dbUser?: any @@ -116,16 +115,16 @@ export const buildUser = async ( } _id = _id || dbUtils.generateGlobalUserID() + user = { createdAt: Date.now(), + ...dbUser, ...user, - ...(dbUser && { - ...dbUser, - }), _id, password: hashedPassword, tenantId, } + // make sure the roles object is always present if (!user.roles) { user.roles = {} @@ -184,7 +183,6 @@ export const save = async ( { hashPassword: true, requirePassword: user.requirePassword, - bulkCreate: true, }, tenantId, dbUser