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
+32
View File
@@ -61,6 +61,18 @@ func generateCode(length int) (string, error) {
return string(result), nil
}
// @Summary Create an invite
// @Description Create an invite code for a server
// @Tags invites
// @Accept json
// @Produce json
// @Security SessionAuth
// @Param serverID path string true "Server ID"
// @Param body body createInviteRequest false "Invite options"
// @Success 201 {object} inviteResponse
// @Failure 401 {object} map[string]string
// @Failure 403 {object} map[string]string
// @Router /servers/{serverID}/invites [post]
func (h *Handler) Create(w http.ResponseWriter, r *http.Request) {
serverID := chi.URLParam(r, "serverID")
userID, ok := middleware.UserIDFromContext(r.Context())
@@ -163,6 +175,14 @@ func (h *Handler) Create(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(invite)
}
// @Summary Get invite info
// @Description Get information about an invite by code
// @Tags invites
// @Produce json
// @Param code path string true "Invite code"
// @Success 200 {object} inviteResponse
// @Failure 404 {object} map[string]string
// @Router /invites/{code} [get]
func (h *Handler) Get(w http.ResponseWriter, r *http.Request) {
code := chi.URLParam(r, "code")
@@ -197,6 +217,18 @@ func (h *Handler) Get(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(invite)
}
// @Summary Join server via invite
// @Description Join a server using an invite code
// @Tags invites
// @Produce json
// @Security SessionAuth
// @Param code path string true "Invite code"
// @Success 200 {object} map[string]string
// @Failure 400 {object} map[string]string
// @Failure 401 {object} map[string]string
// @Failure 404 {object} map[string]string
// @Failure 409 {object} map[string]string
// @Router /invites/{code}/join [post]
func (h *Handler) Join(w http.ResponseWriter, r *http.Request) {
code := chi.URLParam(r, "code")
userID, ok := middleware.UserIDFromContext(r.Context())