Documentation ¶
Index ¶
- type AdminPostVO
- type Category4PostRequest
- type Category4PostVO
- type PageRequest
- type PostCommentAllowedReq
- type PostDetailVO
- type PostDisplayReq
- type PostHandler
- func (h *PostHandler) AddLike(ctx *gin.Context) (*apiwrap.ResponseBody[any], error)
- func (h *PostHandler) AddPost(ctx *gin.Context, req PostReq) (*apiwrap.ResponseBody[any], error)
- func (h *PostHandler) AdminGetPostById(ctx *gin.Context) (*apiwrap.ResponseBody[PostDetailVO], error)
- func (h *PostHandler) AdminGetPosts(ctx *gin.Context, req PageRequest) (*apiwrap.ResponseBody[apiwrap.PageVO[AdminPostVO]], error)
- func (h *PostHandler) DeletePost(ctx *gin.Context) (*apiwrap.ResponseBody[any], error)
- func (h *PostHandler) GetLatestPosts(ctx *gin.Context) (*apiwrap.ResponseBody[apiwrap.ListVO[*SummaryPostVO]], error)
- func (h *PostHandler) GetPostBySug(ctx *gin.Context) (*apiwrap.ResponseBody[domain.DetailPostVO], error)
- func (h *PostHandler) GetPosts(ctx *gin.Context, req *domain.PostRequest) (*apiwrap.ResponseBody[apiwrap.PageVO[*SummaryPostVO]], error)
- func (h *PostHandler) RegisterGinRoutes(engine *gin.Engine)
- func (h *PostHandler) UpdatePostIsCommentAllowed(ctx *gin.Context, req PostCommentAllowedReq) (*apiwrap.ResponseBody[any], error)
- func (h *PostHandler) UpdatePostIsDisplayed(ctx *gin.Context, req PostDisplayReq) (*apiwrap.ResponseBody[any], error)
- type PostReq
- type SummaryPostVO
- type Tag4PostRequest
- type Tag4PostVO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminPostVO ¶
type AdminPostVO struct { Id string `json:"id"` CoverImg string `json:"cover_img"` Title string `json:"title"` Summary string `json:"summary"` Categories []Category4PostVO `json:"categories"` Tags []Tag4PostVO `json:"tags"` IsDisplayed bool `json:"is_displayed"` IsCommentAllowed bool `json:"is_comment_allowed"` CreatedAt int64 `json:"created_at"` UpdatedAt int64 `json:"updated_at"` }
type Category4PostRequest ¶
type Category4PostVO ¶
type PageRequest ¶
type PageRequest struct { // 当前页 PageNo int64 `form:"pageNo" binding:"required"` // 每页数量 PageSize int64 `form:"pageSize" binding:"required"` // 排序字段 Field string `form:"sortField,omitempty"` // 排序规则 Order string `form:"sortOrder,omitempty"` // 搜索内容 Keyword string `form:"keyword,omitempty"` CategoryFilter []string `form:"category_filter,omitempty"` TagFilter []string `form:"tag_filter,omitempty"` }
type PostCommentAllowedReq ¶
type PostCommentAllowedReq struct {
IsCommentAllowed bool `json:"is_comment_allowed"`
}
type PostDetailVO ¶
type PostDetailVO struct { Id string `json:"id"` Author string `json:"author"` Title string `json:"title"` Summary string `json:"summary"` Content string `json:"content"` CoverImg string `json:"cover_img"` Categories []Category4PostVO `json:"categories"` Tags []Tag4PostVO `json:"tags"` IsDisplayed bool `json:"is_displayed"` StickyWeight int `json:"sticky_weight"` MetaDescription string `json:"meta_description"` MetaKeywords string `json:"meta_keywords"` IsCommentAllowed bool `json:"is_comment_allowed"` }
type PostDisplayReq ¶
type PostDisplayReq struct {
IsDisplayed bool `json:"is_displayed"`
}
type PostHandler ¶
type PostHandler struct {
// contains filtered or unexported fields
}
func NewPostHandler ¶
func NewPostHandler(serv service.IPostService, cfgService website_config.Service, postLikeServ post_like.Service, eventBus *eventbus.EventBus) *PostHandler
func (*PostHandler) AddLike ¶
func (h *PostHandler) AddLike(ctx *gin.Context) (*apiwrap.ResponseBody[any], error)
func (*PostHandler) AddPost ¶
func (h *PostHandler) AddPost(ctx *gin.Context, req PostReq) (*apiwrap.ResponseBody[any], error)
func (*PostHandler) AdminGetPostById ¶
func (h *PostHandler) AdminGetPostById(ctx *gin.Context) (*apiwrap.ResponseBody[PostDetailVO], error)
func (*PostHandler) AdminGetPosts ¶
func (h *PostHandler) AdminGetPosts(ctx *gin.Context, req PageRequest) (*apiwrap.ResponseBody[apiwrap.PageVO[AdminPostVO]], error)
func (*PostHandler) DeletePost ¶
func (h *PostHandler) DeletePost(ctx *gin.Context) (*apiwrap.ResponseBody[any], error)
func (*PostHandler) GetLatestPosts ¶
func (h *PostHandler) GetLatestPosts(ctx *gin.Context) (*apiwrap.ResponseBody[apiwrap.ListVO[*SummaryPostVO]], error)
func (*PostHandler) GetPostBySug ¶
func (h *PostHandler) GetPostBySug(ctx *gin.Context) (*apiwrap.ResponseBody[domain.DetailPostVO], error)
func (*PostHandler) GetPosts ¶
func (h *PostHandler) GetPosts(ctx *gin.Context, req *domain.PostRequest) (*apiwrap.ResponseBody[apiwrap.PageVO[*SummaryPostVO]], error)
func (*PostHandler) RegisterGinRoutes ¶
func (h *PostHandler) RegisterGinRoutes(engine *gin.Engine)
func (*PostHandler) UpdatePostIsCommentAllowed ¶
func (h *PostHandler) UpdatePostIsCommentAllowed(ctx *gin.Context, req PostCommentAllowedReq) (*apiwrap.ResponseBody[any], error)
func (*PostHandler) UpdatePostIsDisplayed ¶
func (h *PostHandler) UpdatePostIsDisplayed(ctx *gin.Context, req PostDisplayReq) (*apiwrap.ResponseBody[any], error)
type PostReq ¶
type PostReq struct { Id string `json:"id"` Author string `json:"author"` Title string `json:"title"` Summary string `json:"summary"` Content string `json:"content"` CoverImg string `json:"cover_img"` Categories []Category4PostRequest `json:"categories"` Tags []Tag4PostRequest `json:"tags"` StickyWeight int `json:"sticky_weight"` IsDisplayed bool `json:"is_displayed"` MetaDescription string `json:"meta_description"` MetaKeywords string `json:"meta_keywords"` WordCount int `json:"word_count"` IsCommentAllowed bool `json:"is_comment_allowed"` ReferenceIds []string `json:"reference_ids"` }
type SummaryPostVO ¶
type SummaryPostVO struct { Sug string `json:"sug"` Author string `json:"author"` Title string `json:"title"` Summary string `json:"summary"` CoverImg string `json:"cover_img"` Categories []string `json:"categories"` Tags []string `json:"tags"` LikeCount int `json:"like_count"` CommentCount int `json:"comment_count"` VisitCount int `json:"visit_count"` StickyWeight int `json:"sticky_weight"` CreatedAt int64 `json:"created_at"` }
type Tag4PostRequest ¶
type Tag4PostVO ¶
Click to show internal directories.
Click to hide internal directories.