Добавлен основные классы для сервиса авторизаци

This commit is contained in:
Ганеев Артем
2025-10-28 20:49:54 +03:00
parent def3552a67
commit 736b8031f8
26 changed files with 904 additions and 40 deletions

View 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,
}
}