[ci skip] more suggested improvements
This commit is contained in:
@@ -2,13 +2,11 @@ package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
"vctp/internal/settings"
|
||||
"vctp/internal/tasks"
|
||||
"vctp/server/models"
|
||||
)
|
||||
|
||||
// SnapshotAggregateForce forces regeneration of a daily or monthly summary table.
|
||||
@@ -102,18 +100,5 @@ func (h *Handler) SnapshotAggregateForce(w http.ResponseWriter, r *http.Request)
|
||||
"granularity", granularity,
|
||||
"duration", time.Since(startedAt),
|
||||
)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
json.NewEncoder(w).Encode(map[string]string{
|
||||
"status": "OK",
|
||||
})
|
||||
}
|
||||
|
||||
func writeJSONError(w http.ResponseWriter, status int, message string) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(status)
|
||||
json.NewEncoder(w).Encode(models.ErrorResponse{
|
||||
Status: "ERROR",
|
||||
Message: message,
|
||||
})
|
||||
writeJSONOK(w)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user