mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
update first name, last name and username in community server db on change
This commit is contained in:
parent
870d029cd3
commit
33796181d6
@ -233,6 +233,24 @@ export class UserResolver {
|
||||
// load user and balance
|
||||
const userRepository = getCustomRepository(UserRepository)
|
||||
const userEntity = await userRepository.findByPubkeyHex(context.pubKey)
|
||||
let userEntityChanged = false
|
||||
if (firstName) {
|
||||
userEntity.firstName = firstName
|
||||
userEntityChanged = true
|
||||
}
|
||||
if (lastName) {
|
||||
userEntity.lastName = lastName
|
||||
userEntityChanged = true
|
||||
}
|
||||
if (username) {
|
||||
userEntity.username = username
|
||||
userEntityChanged = true
|
||||
}
|
||||
if (userEntityChanged) {
|
||||
userEntity.save().catch((error) => {
|
||||
throw new Error(error)
|
||||
})
|
||||
}
|
||||
const userSettingRepository = getCustomRepository(UserSettingRepository)
|
||||
userSettingRepository
|
||||
.setOrUpdate(userEntity.id, Setting.COIN_ANIMATION, coinanimation.toString())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user