feat(cron): require job name

This commit is contained in:
Peter Steinberger
2025-12-20 19:56:49 +00:00
parent 9ae73e87eb
commit 2bcdf741f9
13 changed files with 150 additions and 25 deletions

View File

@@ -412,7 +412,8 @@ export const CronJobStateSchema = Type.Object(
export const CronJobSchema = Type.Object(
{
id: NonEmptyString,
name: Type.Optional(Type.String()),
name: NonEmptyString,
description: Type.Optional(Type.String()),
enabled: Type.Boolean(),
createdAtMs: Type.Integer({ minimum: 0 }),
updatedAtMs: Type.Integer({ minimum: 0 }),
@@ -440,7 +441,8 @@ export const CronStatusParamsSchema = Type.Object(
export const CronAddParamsSchema = Type.Object(
{
name: Type.Optional(Type.String()),
name: NonEmptyString,
description: Type.Optional(Type.String()),
enabled: Type.Optional(Type.Boolean()),
schedule: CronScheduleSchema,
sessionTarget: Type.Union([Type.Literal("main"), Type.Literal("isolated")]),

View File

@@ -968,6 +968,7 @@ describe("gateway server", () => {
id: "cron-add-log-1",
method: "cron.add",
params: {
name: "log test",
enabled: true,
schedule: { kind: "at", atMs },
sessionTarget: "main",
@@ -1077,6 +1078,7 @@ describe("gateway server", () => {
id: "cron-add-log-2",
method: "cron.add",
params: {
name: "log test (jobs.json)",
enabled: true,
schedule: { kind: "at", atMs },
sessionTarget: "main",
@@ -1207,6 +1209,7 @@ describe("gateway server", () => {
id: "cron-add-auto-1",
method: "cron.add",
params: {
name: "auto run test",
enabled: true,
schedule: { kind: "at", atMs },
sessionTarget: "main",