MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / List

Method List

internal/api/post.go:142–165  ·  view source on GitHub ↗

List 获取个人帖子列表

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

140
141// List 获取个人帖子列表
142func (ph *PostHandler) List(ctx *gin.Context) {
143 var req req.ListReq
144 if err := ctx.ShouldBindJSON(&req); err != nil {
145 apiresponse.ErrorWithMessage(ctx, "无效的请求参数")
146 return
147 }
148
149 uc, ok := requireUser(ctx)
150 if !ok {
151 return
152 }
153
154 du, err := ph.svc.ListPosts(ctx, domain.Pagination{
155 Page: req.Page,
156 Size: req.Size,
157 Uid: uc.Uid,
158 })
159 if err != nil {
160 apiresponse.ErrorWithMessage(ctx, err.Error())
161 return
162 }
163
164 apiresponse.SuccessWithData(ctx, du)
165}
166
167// ListPub 获取公开帖子列表
168func (ph *PostHandler) ListPub(ctx *gin.Context) {

Callers

nothing calls this directly

Calls 4

ErrorWithMessageFunction · 0.92
SuccessWithDataFunction · 0.92
requireUserFunction · 0.85
ListPostsMethod · 0.65

Tested by

no test coverage detected