25 lines
487 B
Go
25 lines
487 B
Go
package service
|
|
|
|
import (
|
|
"esauth"
|
|
"esauth/pkg/repository"
|
|
)
|
|
|
|
type Authorization interface {
|
|
CreateUser(user *esauth.User) (int64, error)
|
|
SaveUser(user *esauth.User) (int64, error)
|
|
GenerateToken(userId int64) (string, error)
|
|
GenerateInfinityToken(userId int64) (string, error)
|
|
ParseToken(token string) (int64, error)
|
|
}
|
|
|
|
type Service struct {
|
|
Authorization
|
|
}
|
|
|
|
func NewService(repos *repository.Repository) *Service {
|
|
return &Service{
|
|
Authorization: NewAuthService(repos),
|
|
}
|
|
}
|