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

Method DeletePost

internal/api/post.go:237–255  ·  view source on GitHub ↗

DeletePost 删除帖子

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

235
236// DeletePost 删除帖子
237func (ph *PostHandler) DeletePost(ctx *gin.Context) {
238 var req req.DeleteReq
239 if err := ctx.ShouldBindUri(&req); err != nil {
240 apiresponse.ErrorWithMessage(ctx, "无效的请求参数")
241 return
242 }
243
244 uc, ok := requireUser(ctx)
245 if !ok {
246 return
247 }
248
249 if err := ph.svc.Delete(ctx, req.PostId, uc.Uid); err != nil {
250 apiresponse.ErrorWithMessage(ctx, err.Error())
251 return
252 }
253
254 apiresponse.SuccessWithData(ctx, req.PostId)
255}
256
257// Like 点赞/取消点赞
258func (ph *PostHandler) Like(ctx *gin.Context) {

Callers

nothing calls this directly

Calls 4

ErrorWithMessageFunction · 0.92
SuccessWithDataFunction · 0.92
requireUserFunction · 0.85
DeleteMethod · 0.65

Tested by

no test coverage detected