mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-25 09:53:29 +08:00
Go: add context to DAO (#17269)
### Summary DAO layer doesn't use context, this PR is to fix it. --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -432,7 +432,8 @@ func (h *Handler) ListUserAPITokens(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
apiKeys, err := h.service.ListUserAPITokens(username)
|
||||
ctx := c.Request.Context()
|
||||
apiKeys, err := h.service.ListUserAPITokens(ctx, username)
|
||||
if err != nil {
|
||||
common.ErrorWithCode(c, common.CodeServerError, err.Error())
|
||||
return
|
||||
@@ -448,7 +449,8 @@ func (h *Handler) GenerateUserAPIToken(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
apiKey, err := h.service.GenerateUserAPIToken(username)
|
||||
ctx := c.Request.Context()
|
||||
apiKey, err := h.service.GenerateUserAPIToken(ctx, username)
|
||||
if err != nil {
|
||||
common.ErrorWithCode(c, common.CodeServerError, err.Error())
|
||||
return
|
||||
@@ -471,7 +473,8 @@ func (h *Handler) DeleteUserAPIToken(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if err = h.service.DeleteUserAPIToken(username, key); err != nil {
|
||||
ctx := c.Request.Context()
|
||||
if err = h.service.DeleteUserAPIToken(ctx, username, key); err != nil {
|
||||
common.ErrorWithCode(c, common.CodeBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user