Documentation
¶
Index ¶
- func RegisterRoutes(g *echo.Group, db *bun.DB, authMiddleware *auth.Middleware, ...)
- type CreateJobPayload
- type ListJobsOptions
- type ListJobsQuery
- type ListJobsResponse
- type RetrieveJobOptions
- type Service
- func (svc *Service) CleanupOldJobs(ctx context.Context, retentionDays int) (int64, error)
- func (svc *Service) CreateJob(ctx context.Context, job *models.Job) error
- func (svc *Service) HasActiveJob(ctx context.Context, jobType string, libraryID *int) (bool, error)
- func (svc *Service) ListJobs(ctx context.Context, opts ListJobsOptions) ([]*models.Job, error)
- func (svc *Service) ListJobsWithTotal(ctx context.Context, opts ListJobsOptions) ([]*models.Job, int, error)
- func (svc *Service) RetrieveJob(ctx context.Context, opts RetrieveJobOptions) (*models.Job, error)
- func (svc *Service) UpdateJob(ctx context.Context, job *models.Job, opts UpdateJobOptions) error
- type UpdateJobOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶ added in v0.1.0
func RegisterRoutes(g *echo.Group, db *bun.DB, authMiddleware *auth.Middleware, broker *events.Broker, dlCache *downloadcache.Cache)
RegisterRoutes registers job routes on a group the server has already configured with authentication.
Types ¶
type CreateJobPayload ¶
type CreateJobPayload struct {
Type string `json:"type" validate:"required,oneof=export scan bulk_download recompute_review" tstype:"JobType"`
Data interface{} `json:"data" validate:"required" tstype:"JobExportData | JobScanData | JobBulkDownloadData | JobRecomputeReviewData"`
LibraryID *int `json:"library_id,omitempty"`
}
type ListJobsOptions ¶
type ListJobsQuery ¶
type ListJobsQuery struct {
Limit int `query:"limit" json:"limit,omitempty" default:"10" validate:"min=1,max=100"`
Offset int `query:"offset" json:"offset,omitempty" validate:"min=0"`
Status []string `query:"status" json:"status,omitempty" validate:"dive,oneof=pending in_progress completed failed" tstype:"JobStatus[]"`
Type *string `query:"type" json:"type,omitempty" validate:"omitempty,oneof=export scan bulk_download recompute_review" tstype:"JobType"`
LibraryIDOrGlobal *int `query:"library_id_or_global" json:"library_id_or_global,omitempty"`
}
type ListJobsResponse ¶ added in v0.0.47
type ListJobsResponse struct {
Items []*models.Job `json:"items" tstype:"Job[]"`
Total int `json:"total"`
}
ListJobsResponse is the GET /jobs list-endpoint envelope.
type RetrieveJobOptions ¶
type RetrieveJobOptions struct {
ID *int
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) CleanupOldJobs ¶
CleanupOldJobs deletes completed and failed jobs older than the retention period. Associated job_logs are deleted automatically via ON DELETE CASCADE.
func (*Service) HasActiveJob ¶
HasActiveJob checks if there's a pending or in-progress job of the given type. If libraryID is nil, checks for any active scan. If libraryID is set, checks for active scan with that library_id OR library_id IS NULL (global).
func (*Service) ListJobsWithTotal ¶
func (*Service) RetrieveJob ¶
type UpdateJobOptions ¶
type UpdateJobOptions struct {
Columns []string
}
Click to show internal directories.
Click to hide internal directories.