feat: add profile route and ui
ci-api / test (push) Failing after 34m42s
ci-web / test (push) Failing after 24m16s

This commit is contained in:
Nuxgrid
2026-07-28 22:00:46 +02:00
parent cb651a04e2
commit ef280799c1
10 changed files with 297 additions and 4 deletions
@@ -0,0 +1,36 @@
package profile
import (
"github.com/omnex/control-plane/api/internal/auth"
"gorm.io/gorm"
)
// GormStore : Store adossé à PostgreSQL via GORM.
type GormStore struct {
db *gorm.DB
}
func NewGormStore(db *gorm.DB) *GormStore {
return &GormStore{db: db}
}
type Store interface {
UpdateUsername(id, newUsername string) (auth.User, error)
}
func (s *GormStore) UpdateUsername(id, newUsername string) (auth.User, error) {
result := s.db.Model(&auth.User{}).
Where("id = ?", id).
Update("username", newUsername)
if result.Error != nil {
return auth.User{}, result.Error
}
var user auth.User
if err := s.db.First(&user, "id = ?", id).Error; err != nil {
return auth.User{}, err
}
return user, nil
}