Add swaggo annotations to all handlers and regenerate full Swagger docs

- Added @Summary/@Router/@Param/@Success/@Security annotations to all API handlers
- Regenerated docs/swagger.json, docs/swagger.yaml, docs/docs.go with full endpoint definitions
- Fixed generated docs.go to remove unsupported LeftDelim/RightDelim fields
This commit is contained in:
2026-06-28 19:16:42 -04:00
parent 1b7778930c
commit 72ca99b58d
14 changed files with 9581 additions and 4 deletions
+28
View File
@@ -37,11 +37,28 @@ func (h *Handler) RegisterRoutes(r *http.ServeMux) {
r.HandleFunc("GET /push/vapid-public-key", h.GetPublicKey)
}
// @Summary Get VAPID public key
// @Description Get the VAPID public key for push notification subscriptions
// @Tags push
// @Produce json
// @Success 200 {object} map[string]string
// @Router /push/vapid-public-key [get]
func (h *Handler) GetPublicKey(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]string{"publicKey": h.vapidPub})
}
// @Summary Subscribe to push notifications
// @Description Subscribe to push notifications
// @Tags push
// @Accept json
// @Produce json
// @Security SessionAuth
// @Param body body object true "Push subscription with endpoint, p256dh, and auth"
// @Success 200 {object} map[string]string
// @Failure 400 {object} map[string]string
// @Failure 401 {object} map[string]string
// @Router /push/subscribe [post]
func (h *Handler) Subscribe(w http.ResponseWriter, r *http.Request) {
userID, ok := middleware.UserIDFromContext(r.Context())
if !ok {
@@ -75,6 +92,17 @@ func (h *Handler) Subscribe(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(map[string]string{"status": "subscribed"})
}
// @Summary Unsubscribe from push notifications
// @Description Unsubscribe from push notifications
// @Tags push
// @Accept json
// @Produce json
// @Security SessionAuth
// @Param body body object true "Endpoint to unsubscribe"
// @Success 200 {object} map[string]string
// @Failure 400 {object} map[string]string
// @Failure 401 {object} map[string]string
// @Router /push/unsubscribe [post]
func (h *Handler) Unsubscribe(w http.ResponseWriter, r *http.Request) {
userID, ok := middleware.UserIDFromContext(r.Context())
if !ok {