Добавлен основные классы для сервиса авторизаци
This commit is contained in:
29
internal/service/service.go
Normal file
29
internal/service/service.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"authorization/internal"
|
||||
"authorization/internal/repository"
|
||||
)
|
||||
|
||||
type Authorization interface {
|
||||
CreateUser(internal.User) (int, error)
|
||||
GenerateToken(username string, password string) (accessToken string, refreshToken string, err error)
|
||||
ParseToken(token string) (string, error)
|
||||
RefreshToken(refreshToken string) (accessToken string, newRefreshToken string, err error)
|
||||
ChangeUserRole(username string, newRole string) (string, error)
|
||||
}
|
||||
|
||||
type Service struct {
|
||||
Authorization
|
||||
}
|
||||
|
||||
func NewServices(repository *repository.Repository) *Service {
|
||||
|
||||
userService := newUserService(repository)
|
||||
|
||||
authService := newAuthService(userService)
|
||||
|
||||
return &Service{
|
||||
Authorization: authService,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user