feat(#29): implement cron job configuration
- Add CronSchedule model to Prisma schema - Implement CronService with CRUD operations - Add REST API endpoints for cron management - Create MoltBot plugin skill definition (SKILL.md) - TDD: 9 passing tests for CronService
This commit is contained in:
@@ -187,6 +187,7 @@ model Workspace {
|
||||
userLayouts UserLayout[]
|
||||
knowledgeEntries KnowledgeEntry[]
|
||||
knowledgeTags KnowledgeTag[]
|
||||
cronSchedules CronSchedule[]
|
||||
|
||||
@@index([ownerId])
|
||||
@@map("workspaces")
|
||||
@@ -808,3 +809,31 @@ model KnowledgeEmbedding {
|
||||
@@index([entryId])
|
||||
@@map("knowledge_embeddings")
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// CRON JOBS
|
||||
// ============================================
|
||||
|
||||
model CronSchedule {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
workspaceId String @map("workspace_id") @db.Uuid
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
|
||||
// Cron configuration
|
||||
expression String // Standard cron: "0 9 * * *" = 9am daily
|
||||
command String // MoltBot command to trigger
|
||||
|
||||
// State
|
||||
enabled Boolean @default(true)
|
||||
lastRun DateTime? @map("last_run") @db.Timestamptz
|
||||
nextRun DateTime? @map("next_run") @db.Timestamptz
|
||||
|
||||
// Audit
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz
|
||||
|
||||
@@index([workspaceId])
|
||||
@@index([workspaceId, enabled])
|
||||
@@index([nextRun])
|
||||
@@map("cron_schedules")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user