bugfix
This commit is contained in:
@@ -61,6 +61,27 @@ func (h *OutfitHandler) List(c *gin.Context) {
|
||||
response.ToResponse(out)
|
||||
}
|
||||
|
||||
// Community 分页查询社区穿搭(其他用户公开的穿搭)。
|
||||
func (h *OutfitHandler) Community(c *gin.Context) {
|
||||
response := app.NewResponse(c)
|
||||
userID, ok := middleware.GetUserID(c.Request.Context())
|
||||
if !ok {
|
||||
response.ToErrorResponse(errcode.Unauthorized)
|
||||
return
|
||||
}
|
||||
var request dto.OutfitCommunityListRequest
|
||||
if err := c.ShouldBindQuery(&request); err != nil {
|
||||
response.ToErrorResponse(errcode.InvalidParams.WithDetails(err.Error()))
|
||||
return
|
||||
}
|
||||
out, e := h.svc.CommunityList(c.Request.Context(), userID, &request)
|
||||
if e != nil {
|
||||
response.ToErrorResponse(e)
|
||||
return
|
||||
}
|
||||
response.ToResponse(out)
|
||||
}
|
||||
|
||||
// Get 获取穿搭详情(uuid 来自路径参数)。
|
||||
func (h *OutfitHandler) Get(c *gin.Context) {
|
||||
response := app.NewResponse(c)
|
||||
|
||||
@@ -88,6 +88,8 @@ func NewRouter() *gin.Engine {
|
||||
// 穿搭
|
||||
auth.POST("/outfit", outfitHandler.Create)
|
||||
auth.GET("/outfit", outfitHandler.List)
|
||||
// 注意:静态路径 /outfit/community 必须先于 /outfit/:uuid 注册,避免被通配路由抢占
|
||||
auth.GET("/outfit/community", outfitHandler.Community)
|
||||
auth.GET("/outfit/:uuid", outfitHandler.Get)
|
||||
auth.PUT("/outfit/:uuid", outfitHandler.Update)
|
||||
auth.DELETE("/outfit/:uuid", outfitHandler.Delete)
|
||||
|
||||
Reference in New Issue
Block a user