Add setup-flow

This commit is contained in:
2026-03-21 03:12:13 +01:00
parent 80a2f662dc
commit dd044cf5d0
17 changed files with 519 additions and 37 deletions

View File

@@ -25,6 +25,17 @@ func (r *Repository) FindByUsername(username string) (*User, error) {
return &u, nil
}
func (r *Repository) FindByID(id string) (*User, error) {
var u User
if err := r.db.First(&u, id).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, ErrUserNotFound
}
return nil, err
}
return &u, nil
}
func (r *Repository) Create(u *User) error {
return r.db.Create(u).Error
}
@@ -37,6 +48,10 @@ func (r *Repository) GetAll() ([]User, error) {
return users, nil
}
func (r *Repository) Update(u *User) error {
return r.db.Save(u).Error
}
func (r *Repository) Delete(id uint) error {
return r.db.Delete(&User{}, id).Error
}