-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Add support for recurring maintenance tasks that automatically create issues for machines on a schedule (e.g., 'Clean playfield' every month).
Requirements
- Recurring Schedules: Admins should be able to define maintenance tasks that repeat at set intervals (days, weeks, months).
- Auto-Issue Creation: The system should automatically generate a new issue when a schedule is due.
- Admin UI: A management interface for admins to create, edit, pause, or delete maintenance schedules.
- Traceability: Link auto-generated issues back to their schedule for history tracking.
Proposed Data Model
New table: maintenance_schedules
id: UUID (PK)machine_initials: Text (FK to machines)title: Text (Issue title)description: Text (Issue description)interval_type: Enum ('days', 'weeks', 'months')interval_value: Integernext_run_at: Timestamplast_run_at: Timestampis_active: Booleanseverity: Enum (defaults to 'minor')priority: Enum (defaults to 'low')
Technical Implementation
- Database: Add
maintenance_schedulestable via Drizzle migration. - Scheduling Engine:
- Option 1 (Recommended): Use Vercel Cron Jobs to hit a secure internal API route (
/api/cron/maintenance) daily. - Option 2: Use Supabase pg_cron to run a stored procedure.
- Using Vercel Cron allows us to reuse the existing
createIssuelogic insrc/services/issues.ts, including all timeline and notification side-effects.
- Option 1 (Recommended): Use Vercel Cron Jobs to hit a secure internal API route (
- Service Logic: Create a new service (
src/services/maintenance.ts) to handle checking due schedules and triggering issue creation.
Relevant Files
src/server/db/schema.ts: Define the new table.src/services/issues.ts: Reuse for issue creation.src/app/(app)/admin/maintenance/page.tsx: New admin UI page.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels