http

package
v0.0.0-...-4877560 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Router   *mux.Router
	Validate *validator.Validate
	// contains filtered or unexported fields
}

func NewServer

func NewServer(
	logger *zerolog.Logger,
	authRepo usecases.AuthRepo,
	userRepo usecases.UserRepo,
	exerciseRepo usecases.ExerciseRepo,
	trainingRepo usecases.TrainingRepo,
	validate *validator.Validate,
	jwtKey []byte,
	mailer usecases.Mailer,
) *App

func (*App) AddHandlers

func (app *App) AddHandlers()

func (*App) AddResetPasswordRequest

func (app *App) AddResetPasswordRequest(w http.ResponseWriter, req *http.Request)

func (*App) AddTrainingSetExercise

func (app *App) AddTrainingSetExercise(w http.ResponseWriter, req *http.Request)

AddTrainingSetExercise is a handler that adds new set to the training exercise

func (*App) ChangePassword

func (app *App) ChangePassword(w http.ResponseWriter, req *http.Request)

func (*App) CreateExercise

func (app *App) CreateExercise(w http.ResponseWriter, req *http.Request)

func (*App) EndTraining

func (app *App) EndTraining(w http.ResponseWriter, req *http.Request)

EndTraining is a handler that trigger starting of a new training for logged in user.

func (*App) EndTrainingExercise

func (app *App) EndTrainingExercise(w http.ResponseWriter, req *http.Request)

EndTrainingExercise is a handler that stops training exercise

func (*App) GetExerciseByID

func (app *App) GetExerciseByID(w http.ResponseWriter, req *http.Request)

func (*App) GetExercisesByName

func (app *App) GetExercisesByName(w http.ResponseWriter, req *http.Request)

func (*App) GetSessions

func (app *App) GetSessions(w http.ResponseWriter, req *http.Request)

GetSessions returns all user sessions

func (*App) GetTrainingByID

func (app *App) GetTrainingByID(w http.ResponseWriter, req *http.Request)

GetTrainingByID is a handler that returns user training for given id

func (*App) GetUserById

func (app *App) GetUserById(w http.ResponseWriter, req *http.Request)

func (*App) GetUserTrainings

func (app *App) GetUserTrainings(w http.ResponseWriter, req *http.Request)

GetTraining is a handler that returns user trainings

func (*App) Health

func (app *App) Health(w http.ResponseWriter, req *http.Request)

func (*App) Login

func (app *App) Login(w http.ResponseWriter, req *http.Request)

Login validates input and login the user

func (*App) Logout

func (app *App) Logout(w http.ResponseWriter, req *http.Request)

Logout logouts the user, removes token from cookies & storage

func (*App) LogoutAllSessions

func (app *App) LogoutAllSessions(w http.ResponseWriter, req *http.Request)

LogoutSession logouts the user, from the device/browser

func (*App) LogoutSession

func (app *App) LogoutSession(w http.ResponseWriter, req *http.Request)

LogoutSession logouts the user, from the device/browser

func (*App) Refresh

func (app *App) Refresh(w http.ResponseWriter, req *http.Request)

func (*App) Register

func (app *App) Register(w http.ResponseWriter, req *http.Request)

Register validates input, creates new user and login the user

func (*App) Run

func (app *App) Run(addr string)

func (*App) StartTraining

func (app *App) StartTraining(w http.ResponseWriter, req *http.Request)

StartTraining is a handler that trigger starting of a new training for logged in user.

func (*App) StartTrainingExercise

func (app *App) StartTrainingExercise(w http.ResponseWriter, req *http.Request)

StartTrainingExercise is a handler that adds new exercise to the training

func (*App) UpdateExercise

func (app *App) UpdateExercise(w http.ResponseWriter, req *http.Request)

func (*App) UpdatePasswordOnResetRequest

func (app *App) UpdatePasswordOnResetRequest(w http.ResponseWriter, req *http.Request)

type Claims

type Claims struct {
	ID string `json:"id"`
	// IssuedAt is here to make the tokens unique by different payload
	IssuedAt               int64 `json:"createdAt"`
	*entities.RefreshToken `json:"r"`
	jwt.StandardClaims
}

Jump to

Keyboard shortcuts

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