user

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUser

func CreateUser(userSvc *usersvc.Service) fiber.Handler

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

func DeleteUser(
	userSvc *usersvc.Service,
	authSvc *authsvc.Service,
) fiber.Handler

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

func GetUser(userSvc *usersvc.Service) fiber.Handler

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

func Routes(
	app *fiber.App,
	userSvc *usersvc.Service,
	authSvc *authsvc.Service,
	cfg *config.App,
)

Routes registers HTTP routes for user-related operations. Sets up endpoints for user creation, retrieval, update, and deletion.

func UpdateUser

func UpdateUser(
	userSvc *usersvc.Service,
	authSvc *authsvc.Service,
) fiber.Handler

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.

Jump to

Keyboard shortcuts

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