7b4d7ccf68
Provide a unified ops console for inspecting, retrying and cancelling jobs across generation, template/kol assist, knowledge parse, desktop publish/task, compliance review and monitoring collect sources. Wires RabbitMQ for retry republish and consolidates the desktop_publish_jobs columns into the base migration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
86 lines
2.8 KiB
Go
86 lines
2.8 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
const (
|
|
JobPhaseQueued = "queued"
|
|
JobPhaseRunning = "running"
|
|
JobPhaseSucceeded = "succeeded"
|
|
JobPhaseFailed = "failed"
|
|
JobPhaseCanceled = "canceled"
|
|
JobPhaseBlocked = "blocked"
|
|
JobPhaseUnknown = "unknown"
|
|
)
|
|
|
|
type JobFilter struct {
|
|
Source string
|
|
Phase string
|
|
Status string
|
|
Kind string
|
|
Keyword string
|
|
TenantID *int64
|
|
WorkspaceID *int64
|
|
UserID *int64
|
|
StartAt *time.Time
|
|
EndAt *time.Time
|
|
Limit int
|
|
Offset int
|
|
}
|
|
|
|
type JobSummary struct {
|
|
UID string `json:"uid"`
|
|
Source string `json:"source"`
|
|
ID string `json:"id"`
|
|
NumericID *int64 `json:"numeric_id,omitempty"`
|
|
UUID *string `json:"uuid,omitempty"`
|
|
Kind string `json:"kind"`
|
|
Status string `json:"status"`
|
|
Phase string `json:"phase"`
|
|
TenantID *int64 `json:"tenant_id,omitempty"`
|
|
TenantName *string `json:"tenant_name,omitempty"`
|
|
WorkspaceID *int64 `json:"workspace_id,omitempty"`
|
|
WorkspaceName *string `json:"workspace_name,omitempty"`
|
|
UserID *int64 `json:"user_id,omitempty"`
|
|
UserName *string `json:"user_name,omitempty"`
|
|
Title *string `json:"title,omitempty"`
|
|
Target *string `json:"target,omitempty"`
|
|
Queue *string `json:"queue,omitempty"`
|
|
Worker *string `json:"worker,omitempty"`
|
|
Attempts *int `json:"attempts,omitempty"`
|
|
Priority *int `json:"priority,omitempty"`
|
|
ErrorMessage *string `json:"error_message,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
StartedAt *time.Time `json:"started_at,omitempty"`
|
|
CompletedAt *time.Time `json:"completed_at,omitempty"`
|
|
LeaseExpiresAt *time.Time `json:"lease_expires_at,omitempty"`
|
|
AvailableAt *time.Time `json:"available_at,omitempty"`
|
|
LastHeartbeatAt *time.Time `json:"last_heartbeat_at,omitempty"`
|
|
DurationSeconds *int64 `json:"duration_seconds,omitempty"`
|
|
IsStuck bool `json:"is_stuck"`
|
|
CanRetry bool `json:"can_retry"`
|
|
CanCancel bool `json:"can_cancel"`
|
|
}
|
|
|
|
type JobCounts struct {
|
|
Total int64 `json:"total"`
|
|
ByPhase map[string]int64 `json:"by_phase"`
|
|
BySource map[string]int64 `json:"by_source"`
|
|
}
|
|
|
|
type JobListResult struct {
|
|
Items []JobSummary `json:"items"`
|
|
Total int64 `json:"total"`
|
|
Page int `json:"page"`
|
|
Size int `json:"size"`
|
|
Counts JobCounts `json:"counts"`
|
|
}
|
|
|
|
type JobDetail struct {
|
|
JobSummary
|
|
Payload any `json:"payload,omitempty"`
|
|
Result any `json:"result,omitempty"`
|
|
Error any `json:"error,omitempty"`
|
|
Metadata map[string]any `json:"metadata,omitempty"`
|
|
}
|