Start refactoring
This commit is contained in:
36
data/repository/user/user.go
Normal file
36
data/repository/user/user.go
Normal 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")
|
||||
)
|
||||
Reference in New Issue
Block a user