From 8423578bdde5478af110984ee52de44d4e835131 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 13 Feb 2024 20:00:16 -0500 Subject: [PATCH] refactor: more re-organizing --- account/account.go | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/account/account.go b/account/account.go index 9bc2f86..faaf8ba 100644 --- a/account/account.go +++ b/account/account.go @@ -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)