Files
auth-service/internal/service/service.go

30 lines
712 B
Go

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