http

package
v0.0.0-...-21c6822 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UserHandler

type UserHandler struct {
	Log         *logrus.Logger
	UserUsecase usecase.UserUsecase
}

func NewUserHandler

func NewUserHandler(log *logrus.Logger, userUsecase usecase.UserUsecase) *UserHandler

func (*UserHandler) AdminOnly

func (h *UserHandler) AdminOnly(c *gin.Context)

AdminOnly godoc @Summary Admin only endpoint @Description Example endpoint that requires admin access @Tags Admin @Accept json @Produce json @Security BearerAuth @Success 200 {object} httpresp.Response @Failure 401 {object} httpresp.Response @Failure 403 {object} httpresp.Response @Router /admin/test [get]

func (*UserHandler) GetProfile

func (h *UserHandler) GetProfile(c *gin.Context)

GetProfile godoc @Summary Get user profile @Description Get current user's profile information @Tags Authentication @Accept json @Produce json @Security BearerAuth @Success 200 {object} httpresp.Response{data=entity.User} @Failure 401 {object} httpresp.Response @Failure 404 {object} httpresp.Response @Router /auth/profile [get]

func (*UserHandler) Login

func (h *UserHandler) Login(c *gin.Context, req *dto.LoginRequest) error

Login godoc @Summary User login @Description Authenticate user and return JWT token @Tags Authentication @Accept json @Produce json @Param request body dto.LoginRequest true "Login request" @Success 200 {object} httpresp.Response{data=dto.AuthResponse} @Failure 400 {object} httpresp.Response @Failure 401 {object} httpresp.Response @Router /auth/login [post]

func (*UserHandler) Ping

func (h *UserHandler) Ping(c *gin.Context)

Ping godoc @Summary Ping endpoint @Description Health check endpoint @Tags Health @Accept json @Produce json @Success 200 {object} map[string]string @Router /ping [get]

func (*UserHandler) Register

func (h *UserHandler) Register(c *gin.Context, req *dto.RegisterRequest) error

Register godoc @Summary Register a new user @Description Register a new user with username, email, and password @Tags Authentication @Accept json @Produce json @Param request body dto.RegisterRequest true "Registration request" @Success 201 {object} httpresp.Response{data=dto.AuthResponse} @Failure 400 {object} httpresp.Response @Failure 500 {object} httpresp.Response @Router /auth/register [post]

func (*UserHandler) RegisterRoutes

func (h *UserHandler) RegisterRoutes(engine *gin.Engine)

RegisterRoutes implements the HttpRouter interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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