getChatDebugRetentionDays returns the deployment-wide chat debug run retention window. Any authenticated user can read it; writes require admin. nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler.
(rw http.ResponseWriter, r *http.Request)
| 5541 | // |
| 5542 | //nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler. |
| 5543 | func (api *API) getChatDebugRetentionDays(rw http.ResponseWriter, r *http.Request) { |
| 5544 | ctx := r.Context() |
| 5545 | retentionDays, err := api.Database.GetChatDebugRetentionDays(ctx, codersdk.DefaultChatDebugRetentionDays) |
| 5546 | if err != nil { |
| 5547 | httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{ |
| 5548 | Message: "Failed to get chat debug retention days.", |
| 5549 | Detail: err.Error(), |
| 5550 | }) |
| 5551 | return |
| 5552 | } |
| 5553 | httpapi.Write(ctx, rw, http.StatusOK, codersdk.ChatDebugRetentionDaysResponse{ |
| 5554 | DebugRetentionDays: retentionDays, |
| 5555 | }) |
| 5556 | } |
| 5557 | |
| 5558 | // Keep in sync with the validation schema in |
| 5559 | // site/src/pages/AgentsPage/components/DebugRetentionSettings.tsx. |
no test coverage detected