refactor: migrate from raw pgx to GORM, unify ErrNoRows, cleanup auth
ci / build (push) Successful in 2m58s
ci / build (pull_request) Successful in 2m47s

This commit is contained in:
Mephimeow
2026-06-14 16:41:33 +00:00
parent 9da532e9dc
commit 2da484d781
19 changed files with 321 additions and 348 deletions
+8 -2
View File
@@ -4,6 +4,7 @@ import (
"errors"
"log"
"net/http"
"strconv"
"github.com/gin-gonic/gin"
)
@@ -76,16 +77,21 @@ func (h *Handler) GetByID(c *gin.Context) {
}
// @Summary List organizations
// @Description Get all organizations
// @Description Get all organizations with pagination
// @Tags organizations
// @Accept json
// @Produce json
// @Security Bearer
// @Param limit query int false "Page size (default 20)"
// @Param offset query int false "Offset (default 0)"
// @Success 200 {object} OrgListResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/organizations [get]
func (h *Handler) List(c *gin.Context) {
resp, err := h.service.List(c.Request.Context())
limit, _ := strconv.Atoi(c.DefaultQuery("limit", "20"))
offset, _ := strconv.Atoi(c.DefaultQuery("offset", "0"))
resp, err := h.service.List(c.Request.Context(), limit, offset)
if err != nil {
log.Printf("list orgs error: %v", err)
c.JSON(http.StatusInternalServerError, ErrorResponse{Error: "internal server error"})