Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewUserHandler ¶
func NewUserHandler(router *echo.Group, usecase domain.UserUseCase)
Types ¶
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
func (*UserHandler) DeleteUser ¶
func (u *UserHandler) DeleteUser(c echo.Context) error
@Summary Delete current user @Description Delete the current user account @Tags users @Accept json @Produce json @Param user_id path int true "User ID" @Param Authorization header string true "With the bearer started." @Success 204 @Failure 401 {object} httpErrors.RestError @Failure 400 {object} httpErrors.RestError @Failure 404 {object} httpErrors.RestError @Failure 500 {object} httpErrors.RestError @Router /users/{user_id} [delete]
func (*UserHandler) GetUserByID ¶
func (h *UserHandler) GetUserByID(c echo.Context) error
@Summary Get an user account data @Description Get id, email and role from a user @Tags users @Accept json @Produce json @Param user_id path int true "User ID" @Success 200 {object} domain.GetUserResponse @Failure 400 {object} httpErrors.RestError @Failure 404 {object} httpErrors.RestError @Failure 500 {object} httpErrors.RestError @Router /users/{user_id} [get]
func (*UserHandler) LoginUser ¶
func (h *UserHandler) LoginUser(c echo.Context) error
@Summary Login a user @Description Login a user using email and password receive a JWT as a response from a successful login @Tags users @Accept json @Produce json @Param request body domain.LoginRequest true "Login data: email and password" @Success 200 {object} domain.TokenResponse @Failure 400 {object} httpErrors.RestError @Failure 404 {object} httpErrors.RestError @Failure 500 {object} httpErrors.RestError @Router /users/login [post]
func (*UserHandler) RegisterUser ¶
func (h *UserHandler) RegisterUser(c echo.Context) error
@Summary Register a new user @Description Register a user using email, username, password and password confirmation @Tags users @Accept json @Produce json @Param request body domain.SignUpRequest true "Login data: email, password and password confirmation" @Success 201 {object} domain.TokenResponse @Failure 400 {object} httpErrors.RestError @Failure 409 {object} httpErrors.RestError @Failure 500 {object} httpErrors.RestError @Router /users/signup [post]