refactor: more re-organizing

This commit is contained in:
Derrick Hammer 2024-02-13 20:00:16 -05:00
parent f5bb0fa45f
commit 8423578bdd
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 15 additions and 14 deletions

View File

@ -92,20 +92,6 @@ func (s AccountServiceDefault) UpdateAccountName(userId uint, firstName string,
return s.updateAccountInfo(userId, models.User{FirstName: firstName, LastName: lastName})
}
func (s AccountServiceDefault) updateAccountInfo(userId uint, info interface{}) error {
var user models.User
user.ID = userId
result := s.db.Model(&models.User{}).Where(&user).Updates(info)
if result.Error != nil {
return result.Error
}
return nil
}
func (s AccountServiceDefault) AddPubkeyToAccount(user models.User, pubkey string) error {
var model models.PublicKey
@ -281,6 +267,21 @@ func (s AccountServiceDefault) doLogin(user *models.User, ip string) (string, er
return token, nil
}
func (s AccountServiceDefault) updateAccountInfo(userId uint, info interface{}) error {
var user models.User
user.ID = userId
result := s.db.Model(&models.User{}).Where(&user).Updates(info)
if result.Error != nil {
return result.Error
}
return nil
}
func (s *AccountServiceDefault) exists(model interface{}, conditions map[string]interface{}) (bool, interface{}, error) {
// Conduct a query with the provided model and conditions
result := s.db.Model(model).Where(conditions).First(model)