user

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangePasswordRequest

type ChangePasswordRequest struct {
	OldPassword string `json:"old_password" binding:"required"`
	NewPassword string `json:"new_password" binding:"required"`
}

type CreateRequest

type CreateRequest struct {
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
	Role     int    `json:"role"`
	GroupID  *uint  `json:"group_id"`
}

type Handler

type Handler struct {
	Bus app.EventBus
}

func (*Handler) ChangePassword

func (h *Handler) ChangePassword(c *app.Context, req ChangePasswordRequest) (api.StatusResponse, error)

func (*Handler) Create

func (h *Handler) Create(c *app.Context, req CreateRequest) (api.Created[models.User], error)

func (*Handler) Delete

func (h *Handler) Delete(c *app.Context, req api.IDPathRequest) (api.StatusResponse, error)

func (*Handler) Get

func (h *Handler) Get(c *app.Context, req api.IDPathRequest) (models.User, error)

func (*Handler) GetProfile

func (h *Handler) GetProfile(c *app.Context, _ api.EmptyRequest) (ProfileResponse, error)

func (*Handler) List

func (*Handler) Login

func (h *Handler) Login(c *app.Context, req LoginRequest) (LoginResponse, error)

func (*Handler) Register

func (h *Handler) Register(c *app.Context, req RegisterRequest) (api.Created[models.User], error)

func (*Handler) Update

func (h *Handler) Update(c *app.Context, req UpdateRequest) (models.User, error)

func (*Handler) UpdateProfile

func (h *Handler) UpdateProfile(c *app.Context, req UpdateProfileRequest) (ProfileResponse, error)

func (*Handler) UpdateQuota

func (h *Handler) UpdateQuota(c *app.Context, req UpdateQuotaRequest) (api.StatusResponse, error)

type ListRequest

type ListRequest struct {
	api.PaginationQuery
	Search  string `form:"search"`
	Role    string `form:"role"`
	GroupID string `form:"group_id"`
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type LoginResponse

type LoginResponse struct {
	Token string `json:"token"`
}

type ProfileResponse

type ProfileResponse struct {
	models.User
	GroupName string `json:"group_name"`
}

type RegisterRequest

type RegisterRequest struct {
	Username   string `json:"username"    binding:"required,min=3,max=32"`
	Email      string `json:"email"       binding:"required,email"`
	Password   string `json:"password"    binding:"required,min=8,max=64"`
	InviteCode string `json:"invite_code"`
}

type UpdateProfileRequest

type UpdateProfileRequest struct {
	Email       *string `json:"email"        binding:"omitempty,max=191"`
	DisplayName *string `json:"display_name" binding:"omitempty,max=64"`
	AvatarURL   *string `json:"avatar_url"   binding:"omitempty,max=512"`
}

type UpdateQuotaRequest

type UpdateQuotaRequest struct {
	ID    string `uri:"id" binding:"required"`
	Delta *int64 `json:"delta" binding:"required"`
}

type UpdateRequest

type UpdateRequest struct {
	ID     string         `uri:"id" binding:"required"`
	Fields map[string]any `json:"-"`
}

func (*UpdateRequest) SetBodyMap

func (r *UpdateRequest) SetBodyMap(fields map[string]any)

Jump to

Keyboard shortcuts

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