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

Method GetHistory

internal/api/history.go:31–54  ·  view source on GitHub ↗

GetHistory 获取历史记录

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

29
30// GetHistory 获取历史记录
31func (h *HistoryHandler) GetHistory(ctx *gin.Context) {
32 var req req.ListHistoryReq
33
34 if err := ctx.ShouldBindJSON(&req); err != nil {
35 apiresponse.ErrorWithData(ctx, err)
36 return
37 }
38
39 uc, ok := requireUser(ctx)
40 if !ok {
41 return
42 }
43 history, err := h.svc.GetHistory(ctx, domain.Pagination{
44 Page: req.Page,
45 Size: req.Size,
46 Uid: uc.Uid,
47 })
48 if err != nil {
49 apiresponse.ErrorWithMessage(ctx, "获取历史记录失败")
50 return
51 }
52
53 apiresponse.SuccessWithData(ctx, history)
54}
55
56// DeleteOneHistory 删除一条历史记录
57func (h *HistoryHandler) DeleteOneHistory(ctx *gin.Context) {

Callers

nothing calls this directly

Calls 5

ErrorWithDataFunction · 0.92
ErrorWithMessageFunction · 0.92
SuccessWithDataFunction · 0.92
requireUserFunction · 0.85
GetHistoryMethod · 0.65

Tested by

no test coverage detected