Files
geo/server/internal/tenant/transport/publish_job_handler.go
T
root aecdb87fa3 feat(tenant): supersede unknown publish tasks on manual retry
Replace the in-place requeue of submit-uncertain unknown publish tasks
with an explicit supersede-and-create-new flow: manual retries mark the
old unknown task failed (manual_retry_superseded) and create a fresh task
carrying manual_retry / superseded_unknown_task_ids in its payload.

Also fold title-length validation into definitivePublishFailurePattern and
check the pattern before the publish_submit_uncertain guard so those
failures are released from the dedup set.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 22:32:06 +08:00

37 lines
1.0 KiB
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
}
req.AllowSupersedeUnknown = true
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)
}