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:
Jin Hai
2026-07-23 12:15:58 +08:00
committed by GitHub
parent 7b29fc10ca
commit 5478f955ab
45 changed files with 723 additions and 578 deletions

View File

@@ -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
}