fix(render+admin): render queue shows ALL users' jobs
Build backend images / build content-svc (push) Failing after 53s
Build backend images / build file-svc (push) Failing after 55s
Build backend images / build gateway (push) Failing after 58s
Build backend images / build identity-svc (push) Failing after 1m0s
Build backend images / build notification-svc (push) Failing after 49s
Build backend images / build render-svc (push) Failing after 56s
Build backend images / build studio-svc (push) Failing after 59s
Build backend images / build content-svc (push) Failing after 53s
Build backend images / build file-svc (push) Failing after 55s
Build backend images / build gateway (push) Failing after 58s
Build backend images / build identity-svc (push) Failing after 1m0s
Build backend images / build notification-svc (push) Failing after 49s
Build backend images / build render-svc (push) Failing after 56s
Build backend images / build studio-svc (push) Failing after 59s
The admin render queue called the user-scoped /v1/renders (so it only showed the admin's own jobs) and parsed items/total instead of data/meta (→ always empty). - render-svc: GET /v1/admin-renders (admin) → ListAllJobs across users, optional ?status= filter; gateway-wired - admin renders page now fetches /v1/admin-renders and reads data/meta correctly Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/flatrender/render-svc/internal/models"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// GET /v1/admin-renders — all users' render jobs (admin), optional ?status= filter.
|
||||
func (h *RenderHandler) AdminList(c *gin.Context) {
|
||||
status := c.Query("status")
|
||||
page, _ := strconv.Atoi(c.DefaultQuery("page", "1"))
|
||||
if page < 1 {
|
||||
page = 1
|
||||
}
|
||||
pageSize, _ := strconv.Atoi(c.DefaultQuery("page_size", "30"))
|
||||
if pageSize < 1 || pageSize > 100 {
|
||||
pageSize = 30
|
||||
}
|
||||
jobs, total, err := h.store.ListAllJobs(c.Request.Context(), status, page, pageSize)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, models.APIError{Code: "internal_error", Message: err.Error()})
|
||||
return
|
||||
}
|
||||
if jobs == nil {
|
||||
jobs = []*models.RenderJob{}
|
||||
}
|
||||
c.JSON(http.StatusOK, models.PagedResponse[*models.RenderJob]{
|
||||
Data: jobs,
|
||||
Meta: models.PaginationMeta{Page: page, PageSize: pageSize, Total: total, HasMore: int64(page*pageSize) < total},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user