web

package
v0.0.0-...-44de012 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminCommentReplyVO

type AdminCommentReplyVO struct {
	ReplyId string `json:"reply_id"`
	// 回复内容
	Content string `json:"content"`
	// 被回复的回复 Id
	ReplyToId string `json:"reply_to_id"`
	// 用户信息
	UserInfo UserInfo4Reply `json:"user_info"`
	// 被回复用户的信息
	RepliedUserInfo UserInfo4Reply `json:"replied_user_info"`
	ApprovalStatus  bool           `json:"approval_status"`
	// 回复时间
	CreatedAt int64 `json:"created_at"`
	// 修改时间
	UpdatedAt int64 `json:"updated_at"`
}

type AdminCommentVO

type AdminCommentVO struct {
	Id string `json:"id"`
	// 文章信息
	PostInfo PostInfo `json:"post_info"`
	// 评论的内容
	Content string `json:"content"`
	// 用户信息
	UserInfo UserInfo4Comment `json:"user_info"`

	ReplyCount int `json:"reply_count"`

	// 该评论下的所有回复的内容
	Replies        []AdminCommentVO `json:"replies,omitempty"`
	ApprovalStatus bool             `json:"approval_status"`
	Type           string           `json:"type"`
	// 评论时间
	CreatedAt int64 `json:"created_at"`
	// 修改时间
	UpdatedAt int64 `json:"updated_at"`

	// 被回复的回复 Id
	ReplyToId string `json:"reply_to_id"`
}

type AdminUserInfoVO

type AdminUserInfoVO UserInfoVO

type BatchApprovedCommentRequest

type BatchApprovedCommentRequest struct {
	CommentIds []string `json:"comment_ids"`
	// key 为 commentId, value 为 reply_ids
	Replies map[string][]string `json:"replies"`
}

type CommentHandler

type CommentHandler struct {
	// contains filtered or unexported fields
}

func NewCommentHandler

func NewCommentHandler(serv service.ICommentService, cfgService website_config.Service, postServ post.Service, msgServ message.Service) *CommentHandler

func (*CommentHandler) AddComment

func (h *CommentHandler) AddComment(ctx *gin.Context, req CommentRequest) (*apiwrap.ResponseBody[IdVO], error)

func (*CommentHandler) AddCommentReply

func (h *CommentHandler) AddCommentReply(ctx *gin.Context, req ReplyRequest) (*apiwrap.ResponseBody[IdVO], error)

func (*CommentHandler) AdminApproveComment

func (h *CommentHandler) AdminApproveComment(ctx *gin.Context) (*apiwrap.ResponseBody[any], error)

func (*CommentHandler) AdminApproveCommentReply

func (h *CommentHandler) AdminApproveCommentReply(ctx *gin.Context) (*apiwrap.ResponseBody[any], error)

func (*CommentHandler) AdminBatchApproveComments

func (h *CommentHandler) AdminBatchApproveComments(ctx *gin.Context, req BatchApprovedCommentRequest) (*apiwrap.ResponseBody[any], error)

func (*CommentHandler) AdminBatchDeleteComments

func (h *CommentHandler) AdminBatchDeleteComments(ctx *gin.Context, req BatchApprovedCommentRequest) (*apiwrap.ResponseBody[any], error)

func (*CommentHandler) AdminDeleteComment

func (h *CommentHandler) AdminDeleteComment(ctx *gin.Context) (*apiwrap.ResponseBody[any], error)

func (*CommentHandler) AdminDeleteCommentReply

func (h *CommentHandler) AdminDeleteCommentReply(ctx *gin.Context) (*apiwrap.ResponseBody[any], error)

func (*CommentHandler) AdminFindCommentsWithPagination

func (h *CommentHandler) AdminFindCommentsWithPagination(ctx *gin.Context, req PageRequest) (*apiwrap.ResponseBody[*apiwrap.PageVO[AdminCommentVO]], error)

func (*CommentHandler) GetCommentsByPostId

func (h *CommentHandler) GetCommentsByPostId(ctx *gin.Context) (*apiwrap.ResponseBody[apiwrap.ListVO[PostCommentVO]], error)

func (*CommentHandler) GetLatestCommentAndReply

func (h *CommentHandler) GetLatestCommentAndReply(ctx *gin.Context) (*apiwrap.ResponseBody[apiwrap.ListVO[LatestCommentVO]], error)

func (*CommentHandler) RegisterGinRoutes

func (h *CommentHandler) RegisterGinRoutes(engine *gin.Engine)

type CommentRequest

type CommentRequest struct {
	PostId   string `json:"postId" binding:"required"`
	UserName string `json:"username" binding:"required"`
	Email    string `json:"email" binding:"required,validateEmailFormat"`
	Website  string `json:"website"`
	Content  string `json:"content" binding:"required,max=200"`
}

type IdVO

type IdVO struct {
	Id string `json:"id"`
}

type LatestCommentVO

type LatestCommentVO struct {
	PostInfo
	Picture   string `json:"picture"`
	Name      string `json:"name"`
	Content   string `json:"content"`
	CreatedAt int64  `json:"created_at"`
}

type PageRequest

type PageRequest struct {
	// 当前页
	PageNo int64 `form:"pageNo" binding:"required"`
	// 每页数量
	PageSize       int64 `form:"pageSize" binding:"required"`
	ApprovalStatus *bool `form:"approvalStatus"`
	// sort=+field1,-field2
	Sort string `json:"sort"`
}

type PostCommentReplyVO

type PostCommentReplyVO struct {
	Id        string `json:"id"`
	CommentId string `json:"comment_id"`
	// 回复的内容
	Content string `json:"content"`
	// 回复的用户
	Name    string `json:"name"`
	Picture string `json:"picture"`
	Website string `json:"website"`
	// 被回复的回复 Id
	ReplyToId string `json:"reply_to_id"`
	// 被回复的用户
	ReplyTo string `json:"reply_to"`
	// 回复时间
	ReplyTime int64 `json:"reply_time"`
}

type PostCommentVO

type PostCommentVO struct {
	Id string `json:"id"`
	// 评论的内容
	Content string `json:"content"`
	// 评论的用户
	Name        string               `json:"username"`
	Picture     string               `json:"picture"`
	Website     string               `json:"website"`
	CommentTime int64                `json:"comment_time"`
	Replies     []PostCommentReplyVO `json:"replies,omitempty"`
}

type PostInfo

type PostInfo struct {
	// 文章 ID
	PostId string `json:"post_id"`
	// 文章标题字段
	PostTitle string `json:"post_title"`
	// 文章链接
	PostUrl string `json:"post_url"`
}

type ReplyRequest

type ReplyRequest struct {
	PostId string `json:"postId" binding:"required"`
	// 如果是对某个回复进行回复,则是某个回复的 id
	ReplyToId string `json:"replyToId"`
	UserName  string `json:"username" binding:"required"`
	Email     string `json:"email" binding:"required,validateEmailFormat"`
	Website   string `json:"website"`
	Content   string `json:"content" binding:"required,max=200"`
}

type UserInfo

type UserInfo struct {
	Name    string `json:"name"`
	Email   string `json:"email"`
	Ip      string `json:"ip"`
	Picture string `json:"picture"`
	Website string `json:"website"`
}

type UserInfo4Comment

type UserInfo4Comment UserInfo

type UserInfo4Reply

type UserInfo4Reply UserInfo

type UserInfoVO

type UserInfoVO struct {
	Name    string `json:"name"`
	Email   string `json:"email"`
	Ip      string `json:"ip"`
	Website string `json:"website"`
}

Jump to

Keyboard shortcuts

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