feat(generation): resume manual summary jobs

This commit is contained in:
2026-11-23 17:42:30 +01:00
parent 6afe2bdee0
commit 61cc906e0a
22 changed files with 851 additions and 173 deletions

View File

@ -1,6 +1,7 @@
package handlers
import (
"context"
"github.com/gin-gonic/gin"
"github.com/tradarr/backend/internal/ai"
"github.com/tradarr/backend/internal/auth"
@ -15,16 +16,18 @@ import (
)
type Handler struct {
companyCatalog CompanyCatalog
indexSearcher indices.IndexSearcher
generationUseCase generation.UseCase
repo *models.Repository
cfg *config.Config
enc *crypto.Encryptor
registry *scraper.Registry
pipeline *ai.Pipeline
scheduler *scheduler.Scheduler
reportManager *ai.ReportManager
companyCatalog CompanyCatalog
indexSearcher indices.IndexSearcher
generationJobs interface {
Start(context.Context, string) (models.GenerationJob, error)
}
repo *models.Repository
cfg *config.Config
enc *crypto.Encryptor
registry *scraper.Registry
pipeline *ai.Pipeline
scheduler *scheduler.Scheduler
reportManager *ai.ReportManager
}
func New(
@ -51,6 +54,13 @@ func New(
}
}
func (h *Handler) SetGenerationUseCase(uc generation.UseCase) { h.generationUseCase = uc }
func (h *Handler) SetGenerationUseCase(uc generation.UseCase) {
if h.repo != nil && uc != nil {
h.generationJobs = generation.NewJobs(h.repo, uc)
}
}
func (h *Handler) SetGenerationJobs(jobs interface {
Start(context.Context, string) (models.GenerationJob, error)
}) { h.generationJobs = jobs }
func (h *Handler) AdminOnly() gin.HandlerFunc { return auth.AdminOnly(h.repo) }