Start refactoring

This commit is contained in:
Aurélie Delhaie
2023-05-29 17:44:50 +02:00
parent 55ac50f3be
commit c06843cd28
31 changed files with 1125 additions and 1267 deletions

View File

@@ -0,0 +1,36 @@
package user
import (
"errors"
"github.com/google/uuid"
)
type (
UserRepository interface {
UserByID(ID ID) (User, error)
UserByUsername(username string) (User, error)
CreateUser(user NewUserTemplate) (User, error)
}
User interface {
ID() uuid.UUID
Username() string
DisplayName() string
Roles() []Role
SetPassword() string
CheckPassword(password string) bool
}
NewUserTemplate interface {
Username() string
Password() string
DisplayName() string
}
ID uuid.UUID
Role string
)
var (
ErrUserNotFound = errors.New("user not found")
)