-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
featureNew feature or requestNew feature or request
Description
Implementation Order: 2 of 8
Depends on: #29 (models)
Feature: Schedules — Recurring automated tasks for AI agent teams
Summary
Implement the REST API endpoints for managing schedules and viewing run history.
Endpoints
Schedules CRUD
| Method | Path | Description |
|---|---|---|
GET |
/api/schedules |
List all schedules (include team name via join/preload) |
POST |
/api/schedules |
Create a new schedule |
GET |
/api/schedules/:id |
Get schedule by ID |
PUT |
/api/schedules/:id |
Update a schedule |
DELETE |
/api/schedules/:id |
Delete a schedule (and its runs) |
PATCH |
/api/schedules/:id/toggle |
Toggle enabled/disabled |
Schedule Runs
| Method | Path | Description |
|---|---|---|
GET |
/api/schedules/:id/runs |
List runs for a schedule (paginated, newest first) |
GET |
/api/schedules/:id/runs/:runId |
Get a specific run detail |
DTOs
CreateScheduleRequest
type CreateScheduleRequest struct {
Name string `json:"name" validate:"required"`
TeamID string `json:"team_id" validate:"required"`
Prompt string `json:"prompt" validate:"required"`
CronExpression string `json:"cron_expression" validate:"required"`
Timezone string `json:"timezone"` // default UTC
Enabled bool `json:"enabled"` // default true
}UpdateScheduleRequest
type UpdateScheduleRequest struct {
Name *string `json:"name"`
Prompt *string `json:"prompt"`
CronExpression *string `json:"cron_expression"`
Timezone *string `json:"timezone"`
Enabled *bool `json:"enabled"`
}Validation
cron_expressionmust be a valid cron expression (use a parser library to validate)timezonemust be a valid IANA timezone (validate withtime.LoadLocation())team_idmust reference an existing teamnamemust not be empty- On create, calculate and set
next_run_atbased on cron + timezone
Acceptance Criteria
- All endpoints implemented and registered in routes.go
- DTOs with proper validation
- Cron expression validated on create/update
- Timezone validated on create/update
-
next_run_atcalculated on create and on update (when cron/timezone changes) - List endpoints return enriched data (team name, run count)
- Delete cascades to ScheduleRuns
- Unit/integration tests for all endpoints
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew feature or requestNew feature or request
Type
Projects
Status
Todo