services

package
v0.0.0-...-c82f536 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationClaims

type AuthenticationClaims struct {
	jwt.StandardClaims
	// contains filtered or unexported fields
}

type AuthenticationService

type AuthenticationService struct {
	// contains filtered or unexported fields
}

func (*AuthenticationService) SignToken

func (a *AuthenticationService) SignToken(email string, isUser bool) string

func (*AuthenticationService) ValidateToken

func (a *AuthenticationService) ValidateToken(token string) (*jwt.Token, error)

type IAuthenticationService

type IAuthenticationService interface {
	SignToken(email string, isUser bool) string
	ValidateToken(token string) (*jwt.Token, error)
}

func NewAuthenticationService

func NewAuthenticationService() IAuthenticationService

type ILoginService

type ILoginService interface {
	AdminLogin(email, password string) string
}

func NewLoginService

func NewLoginService(ctx context.Context, authenticationService IAuthenticationService) ILoginService

type IUserService

type IUserService interface {
	CreateUser(*models.User) (*models.User, error)
	GetUser(*int) (*models.User, error)
	GetAllUsers() *[]models.User
	UpdateUser(*int, *models.User) (*models.User, error)
	DeleteUser(*int) error
}

func NewUserService

func NewUserService(userDb *gorm.DB, ctx context.Context) IUserService

type LoginService

type LoginService struct {
	AuthenticationService IAuthenticationService
	// contains filtered or unexported fields
}

func (*LoginService) AdminLogin

func (l *LoginService) AdminLogin(email, password string) string

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

func (*UserService) CreateUser

func (u *UserService) CreateUser(user *models.User) (*models.User, error)

func (*UserService) DeleteUser

func (u *UserService) DeleteUser(id *int) error

func (*UserService) GetAllUsers

func (u *UserService) GetAllUsers() *[]models.User

func (*UserService) GetUser

func (u *UserService) GetUser(id *int) (*models.User, error)

func (*UserService) UpdateUser

func (u *UserService) UpdateUser(id *int, user *models.User) (*models.User, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL