FEAT: Added Swagger Docs
Build, Push and Deploy CMS / build-push-deploy (push) Successful in 2m20s

This commit is contained in:
FahdShalhoub
2026-08-16 23:42:00 +03:00
parent cdc5315401
commit f26ea98b52
8 changed files with 1073 additions and 26 deletions
+17 -5
View File
@@ -6,8 +6,20 @@ import (
"net/http"
)
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
// @Router /health [get]
func Health(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, map[string]string{"status": "ok"})
writeJSON(w, http.StatusOK, healthResponse{Status: "ok"})
}
// problemDetails is an error body in the RFC 9457 "Problem Details for HTTP
@@ -17,10 +29,10 @@ func Health(w http.ResponseWriter, r *http.Request) {
// 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"`
Title string `json:"title"`
Status int `json:"status"`
Detail string `json:"detail,omitempty"`
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."`
}
func writeJSON(w http.ResponseWriter, status int, body any) {