fix builder assignment issue

This commit is contained in:
Peter Clement 2022-07-25 17:18:42 +01:00
parent 25d13d4a72
commit c07281639c
1 changed files with 3 additions and 5 deletions

View File

@ -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(),
...user,
...(dbUser && {
...dbUser,
}),
...user,
_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