(
id: string,
updates: Omit<ScheduledJobConfig, "id" | "name">,
)
| 404 | this.removeFromMap(id); |
| 405 | this.persistJobs(); |
| 406 | |
| 407 | return { success: true, message: `Job "${job.config.name}" removed.` }; |
| 408 | } |
| 409 | |
| 410 | updateJob( |
| 411 | id: string, |
| 412 | updates: ScheduledJobUpdate, |
| 413 | ): { success: boolean; message: string } { |
| 414 | const job = this.jobs.get(id); |
| 415 | if (!job) { |
| 416 | return { success: false, message: `Job "${id}" not found.` }; |
| 417 | } |
| 418 | |
| 419 | const nextConfig: ScheduledJobConfig = { |
| 420 | id: job.config.id, |
| 421 | name: updates.name ?? job.config.name, |
| 422 | cron: updates.cron, |
| 423 | prompt: updates.prompt, |
| 424 | promptExamples: updates.promptExamples, |
| 425 | notify: updates.notify, |
| 426 | enabled: updates.enabled, |
| 427 | timezone: updates.timezone, |
| 428 | }; |
| 429 | |
| 430 | const result = this.registerJob(nextConfig); |
| 431 | if (!result.registered) { |
| 432 | return { success: false, message: result.message }; |
| 433 | } |
| 434 | |
| 435 | this.persistJobs(); |
| 436 | return { |
| 437 | success: true, |
| 438 | message: `Job "${nextConfig.name}" updated.`, |
| 439 | }; |
no test coverage detected