mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-26 10:23:28 +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:
@@ -50,9 +50,10 @@ func (h *SystemHandler) ListAPIKeys(c *gin.Context) {
|
||||
}
|
||||
|
||||
tenantID := tenants[0].TenantID
|
||||
ctx := c.Request.Context()
|
||||
|
||||
// Get keys for the tenant
|
||||
keys, err := h.systemService.ListAPIKeys(tenantID)
|
||||
keys, err := h.systemService.ListAPIKeys(ctx, tenantID)
|
||||
if err != nil {
|
||||
common.ResponseWithHttpCodeData(c, http.StatusInternalServerError, 500, nil, "Failed to list keys")
|
||||
return
|
||||
@@ -92,8 +93,10 @@ func (h *SystemHandler) CreateKey(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx := c.Request.Context()
|
||||
|
||||
// Create key
|
||||
key, err := h.systemService.CreateAPIKey(tenantID, &req)
|
||||
key, err := h.systemService.CreateAPIKey(ctx, tenantID, &req)
|
||||
if err != nil {
|
||||
common.ResponseWithHttpCodeData(c, http.StatusInternalServerError, 500, nil, "Failed to create key")
|
||||
return
|
||||
@@ -133,8 +136,10 @@ func (h *SystemHandler) DeleteKey(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx := c.Request.Context()
|
||||
|
||||
// Delete key
|
||||
if err = h.systemService.DeleteAPIKey(tenantID, key); err != nil {
|
||||
if err = h.systemService.DeleteAPIKey(ctx, tenantID, key); err != nil {
|
||||
common.ResponseWithHttpCodeData(c, http.StatusInternalServerError, 500, nil, "Failed to delete key")
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user