users

package
v0.0.0-...-946fd12 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package users @title users actions @host localhost:8090

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthService

type AuthService interface {
	Authenticate(ctx context.Context, email, pwd, deviceID string) (
		auth.AccessToken, auth.RefreshToken, error,
	)
	SignOut(ctx context.Context, userID int, deviceID string) error
	SignOutAll(ctx context.Context, userID int) error
	Refresh(ctx context.Context, userID int, tokenUUID, deviceID string) (
		auth.AccessToken, auth.RefreshToken, error,
	)
}

type Handler

type Handler struct {
	common.BaseHandler
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(
	authService AuthService, signinService SignUpService, pwdResetService ResetPwdService,
	profileService ProfileService,
) Handler

func (Handler) AddRoutes

func (h Handler) AddRoutes(e *echo.Group, m ...echo.MiddlewareFunc)

func (Handler) Deactivate

func (h Handler) Deactivate(ctx echo.Context) error

Deactivate

@Summary Deactivate Profile @Description Deactivate Profile @Tags users @Accept json @Produce json @Success 204 {object} common.EmptyResponse @Failure 400 {object} common.ErrorResponse @Failure 401 {object} common.ErrorResponse @Failure 403 {object} common.ErrorResponse @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /v1/user/profile/deactivate [POST]

func (Handler) GetProfile

func (h Handler) GetProfile(ctx echo.Context) error

GetProfile

@Summary GetProfile @Description GetProfile @Tags users @Accept json @Produce json @Success 200 {object} profileResponse @Failure 400 {object} common.ErrorResponse @Failure 401 {object} common.ErrorResponse @Failure 403 {object} common.ErrorResponse @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /v1/user/profile [GET]

func (Handler) NewPwd

func (h Handler) NewPwd(ctx echo.Context) error

NewPwd

@Summary New Password @Description Set password reset confirmation request @Tags users @Accept json @Param setPwd body newPasswordRequest true "user pwd" @Param token path string true "pwd reset token" @Success 204 {object} common.EmptyResponse @Failure 400 {object} common.ErrorResponse @Failure 401 {object} common.ErrorResponse @Failure 403 {object} common.ErrorResponse @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /v1/set-password/{token} [PUT]

func (Handler) PutProfile

func (h Handler) PutProfile(ctx echo.Context) error

PutProfile

@Summary PutProfile @Description PutProfile @Tags users @Accept json @Produce json @Success 204 {object} common.EmptyResponse @Param profile body profileRequest true "profile update" @Failure 400 {object} common.ErrorResponse @Failure 401 {object} common.ErrorResponse @Failure 403 {object} common.ErrorResponse @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /v1/user/profile [PATCH]

func (Handler) Refresh

func (h Handler) Refresh(ctx echo.Context) error

Refresh

@Summary Refresh User Access and Refresh token @Description Refresh User Access Refresh token @Tags auth @Accept json @Produce json @Success 200 {object} authToken @Failure 400 {object} common.ErrorResponse @Failure 401 {object} common.ErrorResponse @Failure 403 {object} common.ErrorResponse @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Security ApiKeyAuth @Router /v1/refresh-token [PUT]

func (Handler) ResetPwd

func (h Handler) ResetPwd(ctx echo.Context) error

ResetPwd

@Summary Reset Password @Description User password reset confirmation request @Tags users @Accept json @Param resetEmail body resetPwdRequest true "user email" @Success 204 {object} common.EmptyResponse @Failure 400 {object} common.ErrorResponse @Failure 401 {object} common.ErrorResponse @Failure 403 {object} common.ErrorResponse @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /v1/reset-password [POST]

func (Handler) SignIn

func (h Handler) SignIn(ctx echo.Context) error

SignIn

@Summary SignIn User @Description SignIn User @Tags auth @Accept json @Produce json @Success 200 {object} authToken @Param signInUser body signIn true "user login" @Failure 400 {object} common.ErrorResponse @Failure 401 {object} common.ErrorResponse @Failure 403 {object} common.ErrorResponse @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /v1/sign-in [POST]

func (Handler) SignOut

func (h Handler) SignOut(ctx echo.Context) error

SignOut

@Summary SignOut User @Description SignOut User @Tags auth @Accept json @Produce json @Success 204 {object} common.EmptyResponse @Failure 400 {object} common.ErrorResponse @Failure 401 {object} common.ErrorResponse @Failure 403 {object} common.ErrorResponse @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Security ApiKeyAuth @Router /v1/sign-out [PUT]

func (Handler) SignOutAll

func (h Handler) SignOutAll(ctx echo.Context) error

SignOutAll

@Summary SignOut User @Description SignOut User @Tags auth @Accept json @Produce json @Success 204 {object} common.EmptyResponse @Failure 400 {object} common.ErrorResponse @Failure 401 {object} common.ErrorResponse @Failure 403 {object} common.ErrorResponse @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Security ApiKeyAuth @Router /v1/sign-out/all [PUT]

func (Handler) SignUp

func (h Handler) SignUp(ctx echo.Context) error

SignUp

@Summary SignUp User @Description SignUp User and send verification email @Tags registration @Accept json @Produce json @Success 200 {object} authToken @Param signUpUser body signUpRequest true "user data" @Failure 400 {object} common.ErrorResponse @Failure 401 {object} common.ErrorResponse @Failure 403 {object} common.ErrorResponse @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /v1/sign-up [POST]

type ProfileService

type ProfileService interface {
	GetProfile(ctx context.Context, userID int) (*domain.User, error)
	UpdateProfile(ctx context.Context, user *domain.User) error
	Deactivate(ctx context.Context, userID int) error
}

type ResetPwdService

type ResetPwdService interface {
	ResetPassword(ctx context.Context, email string) error
	SetNewPassword(ctx context.Context, token, newPwd string) error
}

type SignUpService

type SignUpService interface {
	SignUp(ctx context.Context, user domain.User) error
}

Jump to

Keyboard shortcuts

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