feat: Enhance Swagger documentation with new admin and user endpoints
Some checks failed
build quyun / Build (push) Failing after 2m1s

- Added definitions for admin authentication, media, posts, orders, and user management.
- Implemented new API paths for admin functionalities including authentication, media management, order processing, and user statistics.
- Updated existing endpoints to improve clarity and structure in the Swagger documentation.
- Introduced new response schemas for various operations to standardize API responses.
This commit is contained in:
2025-12-19 23:43:46 +08:00
parent 49072ddd79
commit 7b18a6a0e6
14 changed files with 4180 additions and 120 deletions

View File

@@ -21,8 +21,14 @@ type UserInfo struct {
Balance int64 `json:"balance"`
}
// @Router /users/profile [get]
// @Bind user local
// Profile 获取当前登录用户的基础信息。
//
// @Summary 获取个人信息
// @Tags Users
// @Produce json
// @Success 200 {object} UserInfo "成功"
// @Router /users/profile [get]
// @Bind user local
func (ctl *users) Profile(ctx fiber.Ctx, user *models.User) (*UserInfo, error) {
return &UserInfo{
ID: user.ID,
@@ -37,11 +43,17 @@ type ProfileForm struct {
Username string `json:"username" validate:"required"`
}
// Update
// Update 修改当前登录用户的用户名。
//
// @Router /users/username [put]
// @Bind user local
// @Bind form body
// @Summary 修改用户名
// @Tags Users
// @Accept json
// @Produce json
// @Param form body ProfileForm true "请求体"
// @Success 200 {object} any "成功"
// @Router /users/username [put]
// @Bind user local
// @Bind form body
func (ctl *users) Update(ctx fiber.Ctx, user *models.User, form *ProfileForm) error {
username := strings.TrimSpace(form.Username)
if len([]rune(username)) > 12 {