5ff2e2e74c
Hard cutover from the browser-extension plugin flow to desktop clients: remove plugin_installations/plugin_sessions tables and related service, handler, router, and generated model code; migrate monitoring quotas and collector types to desktop_clients (UUID primary_client_id); recreate platform_access_snapshots keyed by client_id; update dev-seed and callback types accordingly; mark legacy design docs as historical. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
45 lines
1020 B
Go
45 lines
1020 B
Go
package transport
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/geo-platform/tenant-api/internal/bootstrap"
|
|
"github.com/geo-platform/tenant-api/internal/shared/response"
|
|
"github.com/geo-platform/tenant-api/internal/tenant/app"
|
|
)
|
|
|
|
type MediaHandler struct {
|
|
svc *app.MediaService
|
|
}
|
|
|
|
func NewMediaHandler(a *bootstrap.App) *MediaHandler {
|
|
return &MediaHandler{
|
|
svc: app.NewMediaService(a.DB),
|
|
}
|
|
}
|
|
|
|
func (h *MediaHandler) ListPlatforms(c *gin.Context) {
|
|
data, err := h.svc.ListPlatforms(c.Request.Context())
|
|
if err != nil {
|
|
response.Error(c, err)
|
|
return
|
|
}
|
|
response.Success(c, data)
|
|
}
|
|
|
|
func (h *MediaHandler) ListPublishRecords(c *gin.Context) {
|
|
articleID, err := strconv.ParseInt(c.Param("id"), 10, 64)
|
|
if err != nil {
|
|
response.Error(c, response.ErrBadRequest(40001, "invalid_id", "article id must be a number"))
|
|
return
|
|
}
|
|
data, err := h.svc.ListArticlePublishRecords(c.Request.Context(), articleID)
|
|
if err != nil {
|
|
response.Error(c, err)
|
|
return
|
|
}
|
|
response.Success(c, data)
|
|
}
|