fix builder assignment issue
This commit is contained in:
parent
9e4e005dcb
commit
caa06e5772
|
@ -100,7 +100,6 @@ export const buildUser = async (
|
||||||
opts: SaveUserOpts = {
|
opts: SaveUserOpts = {
|
||||||
hashPassword: true,
|
hashPassword: true,
|
||||||
requirePassword: true,
|
requirePassword: true,
|
||||||
bulkCreate: false,
|
|
||||||
},
|
},
|
||||||
tenantId: string,
|
tenantId: string,
|
||||||
dbUser?: any
|
dbUser?: any
|
||||||
|
@ -116,16 +115,16 @@ export const buildUser = async (
|
||||||
}
|
}
|
||||||
|
|
||||||
_id = _id || dbUtils.generateGlobalUserID()
|
_id = _id || dbUtils.generateGlobalUserID()
|
||||||
|
|
||||||
user = {
|
user = {
|
||||||
createdAt: Date.now(),
|
createdAt: Date.now(),
|
||||||
|
...dbUser,
|
||||||
...user,
|
...user,
|
||||||
...(dbUser && {
|
|
||||||
...dbUser,
|
|
||||||
}),
|
|
||||||
_id,
|
_id,
|
||||||
password: hashedPassword,
|
password: hashedPassword,
|
||||||
tenantId,
|
tenantId,
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure the roles object is always present
|
// make sure the roles object is always present
|
||||||
if (!user.roles) {
|
if (!user.roles) {
|
||||||
user.roles = {}
|
user.roles = {}
|
||||||
|
@ -184,7 +183,6 @@ export const save = async (
|
||||||
{
|
{
|
||||||
hashPassword: true,
|
hashPassword: true,
|
||||||
requirePassword: user.requirePassword,
|
requirePassword: user.requirePassword,
|
||||||
bulkCreate: true,
|
|
||||||
},
|
},
|
||||||
tenantId,
|
tenantId,
|
||||||
dbUser
|
dbUser
|
||||||
|
|
Loading…
Reference in New Issue