All checks were successful
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
34 lines
1.0 KiB
Go
34 lines
1.0 KiB
Go
package store
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"armature/models"
|
|
)
|
|
|
|
// ScheduledTaskStore manages user-created cron-scheduled Starlark scripts.
|
|
type ScheduledTaskStore interface {
|
|
// CRUD
|
|
Create(ctx context.Context, t *models.ScheduledTask) error
|
|
GetByID(ctx context.Context, id string) (*models.ScheduledTask, error)
|
|
Update(ctx context.Context, t *models.ScheduledTask) error
|
|
Delete(ctx context.Context, id string) error
|
|
|
|
// Queries
|
|
List(ctx context.Context, opts ScheduledTaskListOptions) ([]models.ScheduledTask, int, error)
|
|
ListByCreator(ctx context.Context, creatorID string) ([]models.ScheduledTask, error)
|
|
ListEnabled(ctx context.Context) ([]models.ScheduledTask, error)
|
|
|
|
// Lifecycle
|
|
SetEnabled(ctx context.Context, id string, enabled bool) error
|
|
UpdateFireState(ctx context.Context, id string, lastFireAt time.Time, nextFireAt *time.Time, lastError string, durationMs int) error
|
|
}
|
|
|
|
// ScheduledTaskListOptions provides filtering for scheduled task list queries.
|
|
type ScheduledTaskListOptions struct {
|
|
ListOptions
|
|
CreatorID string
|
|
Enabled *bool
|
|
}
|