Documentation
¶
Index ¶
- Variables
- type CreateInput
- type DeleteResult
- type Optional
- type Repository
- type RunDueReport
- type ScheduledJob
- type Service
- func (s *Service) Create(ctx context.Context, input CreateInput) (ScheduledJob, error)
- func (s *Service) Delete(ctx context.Context, jobID uuid.UUID) (DeleteResult, error)
- func (s *Service) Get(ctx context.Context, jobID uuid.UUID) (ScheduledJob, error)
- func (s *Service) List(ctx context.Context, projectID uuid.UUID) ([]ScheduledJob, error)
- func (s *Service) RunDue(ctx context.Context) (RunDueReport, error)
- func (s *Service) SetNowFunc(now func() time.Time)
- func (s *Service) Trigger(ctx context.Context, jobID uuid.UUID) (TriggerResult, error)
- func (s *Service) Update(ctx context.Context, input UpdateInput) (ScheduledJob, error)
- type TicketTemplate
- type TicketTemplateRepoScope
- type TriggerResult
- type UpdateInput
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrProjectNotFound = domain.ErrProjectNotFound ErrWorkflowNotFound = domain.ErrWorkflowNotFound ErrScheduledJobNotFound = domain.ErrScheduledJobNotFound ErrScheduledJobConflict = domain.ErrScheduledJobConflict ErrStatusNotFound = domain.ErrStatusNotFound ErrInvalidCronExpression = errors.New("scheduled job cron expression is invalid") ErrInvalidTicketTemplate = errors.New("scheduled job ticket template is invalid") )
Functions ¶
This section is empty.
Types ¶
type CreateInput ¶
type DeleteResult ¶
type Repository ¶
type Repository interface {
EnsureProjectExists(ctx context.Context, projectID uuid.UUID) error
ListProjectRepoIDs(ctx context.Context, projectID uuid.UUID) ([]uuid.UUID, error)
List(ctx context.Context, projectID uuid.UUID) ([]domain.Job, error)
Get(ctx context.Context, jobID uuid.UUID) (domain.Job, error)
Create(ctx context.Context, job domain.Job) (domain.Job, error)
Update(ctx context.Context, job domain.Job) (domain.Job, error)
Delete(ctx context.Context, jobID uuid.UUID) error
ListDue(ctx context.Context, now time.Time) ([]domain.Job, error)
LoadWorkflow(ctx context.Context, projectID uuid.UUID, workflowID uuid.UUID) (domain.Workflow, error)
ResolveStatusIDByName(ctx context.Context, projectID uuid.UUID, statusName string) (uuid.UUID, error)
}
type RunDueReport ¶
type ScheduledJob ¶
type ScheduledJob struct {
ID uuid.UUID `json:"id"`
ProjectID uuid.UUID `json:"project_id"`
Name string `json:"name"`
CronExpression string `json:"cron_expression"`
TicketTemplate TicketTemplate `json:"ticket_template"`
IsEnabled bool `json:"is_enabled"`
LastRunAt *time.Time `json:"last_run_at,omitempty"`
NextRunAt *time.Time `json:"next_run_at,omitempty"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repo Repository, tickets ticketCreator, logger *slog.Logger) *Service
func (*Service) Create ¶
func (s *Service) Create(ctx context.Context, input CreateInput) (ScheduledJob, error)
func (*Service) SetNowFunc ¶
func (*Service) Update ¶
func (s *Service) Update(ctx context.Context, input UpdateInput) (ScheduledJob, error)
type TicketTemplate ¶
type TicketTemplate struct {
Title string `json:"title"`
Description string `json:"description"`
Status string `json:"status,omitempty"`
Priority ticketservice.Priority `json:"priority"`
Type ticketservice.Type `json:"type"`
CreatedBy string `json:"created_by"`
BudgetUSD float64 `json:"budget_usd,omitempty"`
RepoScopes []TicketTemplateRepoScope `json:"repo_scopes,omitempty"`
}
func ParseRawTicketTemplate ¶
func ParseRawTicketTemplate(raw map[string]any) (TicketTemplate, error)
func (TicketTemplate) Raw ¶
func (t TicketTemplate) Raw() map[string]any
type TicketTemplateRepoScope ¶ added in v0.5.0
type TriggerResult ¶
type TriggerResult struct {
Job ScheduledJob `json:"job"`
Ticket ticketservice.Ticket `json:"ticket"`
}
Click to show internal directories.
Click to hide internal directories.