FEAT: Added MOre Video Statuses
Build, Push and Deploy CMS / build-push-deploy (push) Failing after 2m2s
Build, Push and Deploy CMS / build-push-deploy (push) Failing after 2m2s
This commit is contained in:
@@ -4,35 +4,19 @@ import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
"net/http"
|
||||
"thamanyah/cms/v2/internal/api"
|
||||
)
|
||||
|
||||
type healthResponse struct {
|
||||
Status string `json:"status" example:"ok"`
|
||||
}
|
||||
|
||||
// Health is the liveness probe the ALB target group polls.
|
||||
//
|
||||
// @Summary Health check
|
||||
// @Description Reports that the service is up and serving. Used as the ALB target group health check; it does not verify the database or S3 connections.
|
||||
// @Tags system
|
||||
// @Produce json
|
||||
// @Success 200 {object} healthResponse
|
||||
// @Success 200 {object} api.HealthResponse
|
||||
// @Router /health [get]
|
||||
func Health(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusOK, healthResponse{Status: "ok"})
|
||||
}
|
||||
|
||||
// problemDetails is an error body in the RFC 9457 "Problem Details for HTTP
|
||||
// APIs" format. Type stays "about:blank" — the value RFC 9457 defines for
|
||||
// problems with no dedicated documentation URI. Title is a short summary that
|
||||
// stays identical for every occurrence of the same problem, so clients can
|
||||
// branch on it; Detail explains this particular occurrence and is the only
|
||||
// member that varies with request data.
|
||||
type problemDetails struct {
|
||||
Type string `json:"type" example:"about:blank"`
|
||||
Title string `json:"title" example:"Title is required."`
|
||||
Status int `json:"status" example:"422"`
|
||||
Detail string `json:"detail,omitempty" example:"The 'title' field was absent or contained only whitespace. Every video needs a non-empty title."`
|
||||
writeJSON(w, http.StatusOK, api.HealthResponse{Status: "ok"})
|
||||
}
|
||||
|
||||
func writeJSON(w http.ResponseWriter, status int, body any) {
|
||||
@@ -40,7 +24,7 @@ func writeJSON(w http.ResponseWriter, status int, body any) {
|
||||
}
|
||||
|
||||
func writeProblem(w http.ResponseWriter, status int, title, detail string) {
|
||||
writeJSONContent(w, "application/problem+json", status, problemDetails{
|
||||
writeJSONContent(w, "application/problem+json", status, api.ProblemDetails{
|
||||
Type: "about:blank",
|
||||
Title: title,
|
||||
Status: status,
|
||||
|
||||
Reference in New Issue
Block a user