745cdd79cf
Implements the Revision 8/9 compliance design: tenant + ops backends, ops-web content-safety pages, admin-web editor/publish gate integration, desktop publish block surfacing, and supporting migrations / shared types / config plumbing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
36 lines
994 B
Go
36 lines
994 B
Go
package transport
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/geo-platform/tenant-api/internal/bootstrap"
|
|
"github.com/geo-platform/tenant-api/internal/shared/auth"
|
|
"github.com/geo-platform/tenant-api/internal/shared/response"
|
|
"github.com/geo-platform/tenant-api/internal/tenant/app"
|
|
)
|
|
|
|
type PublishJobHandler struct {
|
|
svc *app.PublishJobService
|
|
}
|
|
|
|
func NewPublishJobHandler(a *bootstrap.App) *PublishJobHandler {
|
|
return &PublishJobHandler{
|
|
svc: app.NewPublishJobServiceWithConfig(a.DB, a.RabbitMQ, a.Redis, a.Logger, a.ConfigStore).WithCache(a.Cache),
|
|
}
|
|
}
|
|
|
|
func (h *PublishJobHandler) Create(c *gin.Context) {
|
|
var req app.CreatePublishJobRequest
|
|
if err := c.ShouldBindJSON(&req); err != nil {
|
|
response.Error(c, response.ErrBadRequest(40001, "invalid_params", err.Error()))
|
|
return
|
|
}
|
|
|
|
data, err := h.svc.Create(c.Request.Context(), auth.MustActor(c.Request.Context()), req)
|
|
if err != nil {
|
|
response.Error(c, err)
|
|
return
|
|
}
|
|
response.SuccessWithStatus(c, 201, data)
|
|
}
|