Go: add audit log framework (#17129)

### Summary

Prepare for audit log

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-07-20 23:50:45 +08:00
committed by GitHub
parent f45f03a016
commit 3670b047f0
11 changed files with 229 additions and 6 deletions

View File

@@ -1968,3 +1968,29 @@ func (h *Handler) GetTokenStatsSummary(c *gin.Context) {
common.SuccessWithData(c, stats, "success")
}
func (h *Handler) ListLogs(c *gin.Context) {
userName := c.Query("user_name")
if userName == "" {
common.ErrorWithCode(c, common.CodeBadRequest, "User name is required")
return
}
days := c.Query("days")
if days == "" {
days = "7"
}
daysInt, err := strconv.Atoi(days)
if err != nil {
common.ErrorWithCode(c, common.CodeBadRequest, "Invalid days")
return
}
stats, err := h.service.ListLogs(userName, daysInt)
if err != nil {
common.ErrorWithCode(c, common.CodeDataError, err.Error())
return
}
common.SuccessWithData(c, stats, "success")
}