handlers

package
v0.0.0-...-468ce51 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateJWT

func GenerateJWT() (string, error)

GenerateJWT generates JWT Token

Types

type AuthHandler

type AuthHandler struct {
}

AuthHandler handles all the operations related to the JWT Tokens

func NewAuthHandler

func NewAuthHandler() *AuthHandler

NewAuthHandler returns a new instance of the Auth Handler

func (*AuthHandler) GenerateToken

func (handler *AuthHandler) GenerateToken(w http.ResponseWriter, r *http.Request)

GenerateToken generates a new JWT Token

type AuthenticationIface

type AuthenticationIface interface {
	GenerateToken(w http.ResponseWriter, r *http.Request)
	IsAuthorized(endpoint func(http.ResponseWriter, *http.Request)) http.Handler
}

AuthenticationIface abstracts the functionlities on authentication handler

type EmployeeHandler

type EmployeeHandler struct {
	EmployeeService services.EmployeeServiceIface
}

EmployeeHandler handles all the operations related to the Employees

func NewEmployeeHandler

func NewEmployeeHandler() *EmployeeHandler

NewEmployeeHandler returns a new instance of the EmployeeHandler

func (*EmployeeHandler) DeleteEmployee

func (handler *EmployeeHandler) DeleteEmployee(w http.ResponseWriter, r *http.Request)

DeleteEmployee deletes/inactivates an employee

func (*EmployeeHandler) GetEmployee

func (handler *EmployeeHandler) GetEmployee(w http.ResponseWriter, r *http.Request)

GetEmployee gets specific employee details

func (*EmployeeHandler) ListEmployees

func (handler *EmployeeHandler) ListEmployees(w http.ResponseWriter, r *http.Request)

ListEmployees handler handles the bussiness logic for listing all the Employees

func (*EmployeeHandler) PostEmployee

func (handler *EmployeeHandler) PostEmployee(w http.ResponseWriter, r *http.Request)

PostEmployee handler handles the bussiness logic for posting a new Employee

func (*EmployeeHandler) RestoreEmployeeStatus

func (handler *EmployeeHandler) RestoreEmployeeStatus(w http.ResponseWriter, r *http.Request)

RestoreEmployeeStatus handles the bussiness logic for Restoring Soft deleted employee

func (*EmployeeHandler) SearchEmployee

func (handler *EmployeeHandler) SearchEmployee(w http.ResponseWriter, r *http.Request)

SearchEmployee handles the bussiness logic for retrieving the list of employees based on a search query

func (*EmployeeHandler) UpdateEmployeeDetails

func (handler *EmployeeHandler) UpdateEmployeeDetails(w http.ResponseWriter, r *http.Request)

UpdateEmployeeDetails handles the bussiness logic for Updating/deleting the EmployeeDetails

type EmployeeHandlerIface

type EmployeeHandlerIface interface {
	SearchEmployee(w http.ResponseWriter, r *http.Request)
	PostEmployee(w http.ResponseWriter, r *http.Request)
	ListEmployees(w http.ResponseWriter, r *http.Request)
	UpdateEmployeeDetails(w http.ResponseWriter, r *http.Request)
	RestoreEmployeeStatus(w http.ResponseWriter, r *http.Request)
	GetEmployee(w http.ResponseWriter, r *http.Request)
	DeleteEmployee(w http.ResponseWriter, r *http.Request)
}

EmployeeHandlerIface abstracts all the functionalities of the employees handler

Jump to

Keyboard shortcuts

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