Documentation
¶
Index ¶
- func CreateUser(userSvc *usersvc.Service) fiber.Handler
- func DeleteUser(userSvc *usersvc.Service, authSvc *authsvc.Service) fiber.Handler
- func GetUser(userSvc *usersvc.Service) fiber.Handler
- func Routes(app *fiber.App, userSvc *usersvc.Service, authSvc *authsvc.Service, ...)
- func UpdateUser(userSvc *usersvc.Service, authSvc *authsvc.Service) fiber.Handler
- type NewUser
- type PasswordInput
- type UpdateUserInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateUser ¶
CreateUser creates a new user account. @Summary Create a new user @Description Create a new user account with username, email, and password @Tags users @Accept json @Produce json @Param request body NewUser true "User creation data" @Success 201 {object} common.Response @Failure 400 {object} common.ProblemDetails @Failure 401 {object} common.ProblemDetails @Failure 429 {object} common.ProblemDetails @Failure 500 {object} common.ProblemDetails @Router /user [post]
func DeleteUser ¶
DeleteUser deletes a user account. @Summary Delete user @Description Delete a user account by ID with password confirmation @Tags users @Accept json @Produce json @Param id path string true "User ID" @Param request body PasswordInput true "Password confirmation" @Success 204 {object} common.Response @Failure 400 {object} common.ProblemDetails @Failure 401 {object} common.ProblemDetails @Failure 429 {object} common.ProblemDetails @Failure 500 {object} common.ProblemDetails @Router /user/{id} [delete] @Security Bearer
func GetUser ¶
GetUser returns a Fiber handler for retrieving a user by ID. @Summary Get user by ID @Description Retrieve a user by their ID @Tags users @Accept json @Produce json @Param id path string true "User ID" @Success 200 {object} common.Response @Failure 400 {object} common.ProblemDetails @Failure 401 {object} common.ProblemDetails @Failure 404 {object} common.ProblemDetails @Router /user/{id} [get] @Security Bearer
func Routes ¶
Routes registers HTTP routes for user-related operations. Sets up endpoints for user creation, retrieval, update, and deletion.
func UpdateUser ¶
UpdateUser updates user information. @Summary Update user @Description Update user information by ID @Tags users @Accept json @Produce json @Param id path string true "User ID" @Param request body UpdateUserInput true "User update data" @Success 200 {object} common.Response @Failure 400 {object} common.ProblemDetails @Failure 401 {object} common.ProblemDetails @Failure 429 {object} common.ProblemDetails @Failure 500 {object} common.ProblemDetails @Router /user/{id} [put] @Security Bearer
Types ¶
type NewUser ¶
type NewUser struct {
Username string `json:"username" validate:"required,max=50,min=3"`
Email string `json:"email" validate:"required,email,max=50"`
Password string `json:"password" validate:"required,min=6,max=72"`
}
NewUser represents the request body for creating a new user.
type PasswordInput ¶
type PasswordInput struct {
Password string `json:"password" validate:"required"`
}
PasswordInput represents the request body for password confirmation operations.
type UpdateUserInput ¶
type UpdateUserInput struct {
Names string `json:"names" validate:"max=100"`
}
UpdateUserInput represents the request body for updating user information.