chore: finish profile
ci-api / test (push) Failing after 11m37s
ci-web / test (push) Successful in 14m39s

This commit is contained in:
Nuxgrid
2026-07-29 14:50:31 +02:00
parent 5a0c1bfe3f
commit 6beabfb070
16 changed files with 137 additions and 527 deletions
@@ -17,6 +17,8 @@ func NewGormStore(db *gorm.DB) *GormStore {
type Store interface {
UpdateUsername(id, newUsername string) (auth.User, error)
UpdatePassword(id, passwordHahs string) (auth.User, error)
GetTelegram(id string) (auth.User, error)
SetTelegram(id, telegram string) (auth.User, error)
}
func (s *GormStore) UpdateUsername(id, newUsername string) (auth.User, error) {
@@ -36,8 +38,16 @@ func (s *GormStore) UpdateUsername(id, newUsername string) (auth.User, error) {
return user, nil
}
func (s *GormStore) UpdatePassword(id, passwordHash string) (auth.User, error) {
result := s.db.Model(&auth.User{}).Where("id = ?", id).Update("password", passwordHash)
func (s *GormStore) GetTelegram(id string) (auth.User, error) {
var user auth.User
if err := s.db.First(&user, "id = ?", id).Error; err != nil {
return auth.User{}, err
}
return user, nil
}
func (s *GormStore) SetTelegram(id, telegram string) (auth.User, error) {
result := s.db.Model(&auth.User{}).Where("id = ?", id).Update("telegram", telegram)
if result.Error != nil {
return auth.User{}, result.Error
}