feat: Enhance Swagger documentation with new admin and user endpoints
Some checks failed
build quyun / Build (push) Failing after 2m1s
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:
@@ -14,6 +14,13 @@ import (
|
||||
"go.ipao.vip/gen/types"
|
||||
)
|
||||
|
||||
// OrderListItem 用于订单列表展示,补充作品标题与用户名等冗余信息,避免前端二次查询。
|
||||
type OrderListItem struct {
|
||||
*models.Order
|
||||
PostTitle string `json:"post_title"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
// @provider
|
||||
type orders struct{}
|
||||
|
||||
@@ -51,15 +58,8 @@ func (m *orders) List(
|
||||
postMap := lo.SliceToMap(posts, func(p *models.Post) (int64, *models.Post) { return p.ID, p })
|
||||
userMap := lo.SliceToMap(users, func(u *models.User) (int64, *models.User) { return u.ID, u })
|
||||
|
||||
// OrderListItem 用于订单列表展示,补充作品标题与用户名等冗余信息,避免前端二次查询。
|
||||
type orderListItem struct {
|
||||
*models.Order
|
||||
PostTitle string `json:"post_title"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
items := lo.Map(orders, func(o *models.Order, _ int) *orderListItem {
|
||||
item := &orderListItem{Order: o}
|
||||
items := lo.Map(orders, func(o *models.Order, _ int) *OrderListItem {
|
||||
item := &OrderListItem{Order: o}
|
||||
if post, ok := postMap[o.PostID]; ok {
|
||||
item.PostTitle = post.Title
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user