This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"time"
|
||||
"vctp/internal/settings"
|
||||
"vctp/internal/tasks"
|
||||
"vctp/server/models"
|
||||
)
|
||||
|
||||
// SnapshotAggregateForce forces regeneration of a daily or monthly summary table.
|
||||
@@ -18,9 +19,9 @@ import (
|
||||
// @Param type query string true "Aggregation type: daily or monthly"
|
||||
// @Param date query string true "Daily date (YYYY-MM-DD) or monthly date (YYYY-MM)"
|
||||
// @Param granularity query string false "Monthly aggregation granularity: hourly or daily"
|
||||
// @Success 200 {object} map[string]string "Aggregation complete"
|
||||
// @Failure 400 {object} map[string]string "Invalid request"
|
||||
// @Failure 500 {object} map[string]string "Server error"
|
||||
// @Success 200 {object} models.StatusResponse "Aggregation complete"
|
||||
// @Failure 400 {object} models.ErrorResponse "Invalid request"
|
||||
// @Failure 500 {object} models.ErrorResponse "Server error"
|
||||
// @Router /api/snapshots/aggregate [post]
|
||||
func (h *Handler) SnapshotAggregateForce(w http.ResponseWriter, r *http.Request) {
|
||||
snapshotType := strings.ToLower(strings.TrimSpace(r.URL.Query().Get("type")))
|
||||
@@ -112,8 +113,8 @@ func (h *Handler) SnapshotAggregateForce(w http.ResponseWriter, r *http.Request)
|
||||
func writeJSONError(w http.ResponseWriter, status int, message string) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(status)
|
||||
json.NewEncoder(w).Encode(map[string]string{
|
||||
"status": "ERROR",
|
||||
"message": message,
|
||||
json.NewEncoder(w).Encode(models.ErrorResponse{
|
||||
Status: "ERROR",
|
||||
Message: message,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user