web

package
v0.0.0-...-35f6f21 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

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 Category4PostRequest struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type Category4PostVO

type Category4PostVO struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

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 (*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 (*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 Tag4PostRequest struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type Tag4PostVO

type Tag4PostVO struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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