( id: string, message: string, )
| 107 | } |
| 108 | |
| 109 | export async function updateCronPromptAction( |
| 110 | id: string, |
| 111 | message: string, |
| 112 | ): Promise<{ ok: boolean; error?: string }> { |
| 113 | const trimmed = message.trim(); |
| 114 | if (!trimmed) return { ok: false, error: "Prompt cannot be empty." }; |
| 115 | try { |
| 116 | getDb() |
| 117 | .prepare("UPDATE scheduled_jobs SET message = ?, updated_at = ? WHERE id = ?") |
| 118 | .run(trimmed, new Date().toISOString(), id); |
| 119 | invalidateCronCache(); |
| 120 | revalidatePath("/", "layout"); |
| 121 | return { ok: true }; |
| 122 | } catch (err) { |
| 123 | return { ok: false, error: err instanceof Error ? err.message : String(err) }; |
| 124 | } |
| 125 | } |
no test coverage detected