From 0939de394287130e55b53087e6da0fa6552c0064 Mon Sep 17 00:00:00 2001 From: ingalls Date: Thu, 5 Dec 2024 11:42:00 -0700 Subject: [PATCH] Fix build with optional cron --- api/lib/events-pool.ts | 4 +++- api/lib/models/Layer.ts | 2 +- api/lib/schema.ts | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/api/lib/events-pool.ts b/api/lib/events-pool.ts index d0372dd7f..31f56fbcf 100644 --- a/api/lib/events-pool.ts +++ b/api/lib/events-pool.ts @@ -48,7 +48,9 @@ export default class EventsPool { for (const layer of layers.values()) { try { - this.add(layer.id, layer.cron); + if (layer.cron) { + this.add(layer.id, layer.cron); + } } catch (err) { console.error(`CloudTAK Cron: Init Error on Layer ${layer.id}`, err); } diff --git a/api/lib/models/Layer.ts b/api/lib/models/Layer.ts index 71e2c0a3e..da120c7fd 100644 --- a/api/lib/models/Layer.ts +++ b/api/lib/models/Layer.ts @@ -20,6 +20,7 @@ export const AugmentedLayer = Type.Object({ uuid: Type.String(), name: Type.String(), webhooks: Type.Boolean(), + cron: Type.Union([Type.String(), Type.Null()]), description: Type.String(), enabled: Type.Boolean(), enabled_styles: Type.Boolean(), @@ -28,7 +29,6 @@ export const AugmentedLayer = Type.Object({ stale: Type.Integer(), task: Type.String(), connection: Type.Optional(Type.Integer()), - cron: Type.String(), environment: Type.Any(), ephemeral: Type.Record(Type.String(), Type.String()), config: Layer_Config, diff --git a/api/lib/schema.ts b/api/lib/schema.ts index ba57b02d0..ebbffb71c 100644 --- a/api/lib/schema.ts +++ b/api/lib/schema.ts @@ -257,7 +257,8 @@ export const LayerTemplate = pgTable('layers_template', { logging: boolean().notNull().default(true), stale: integer().notNull().default(20), task: text().notNull(), - cron: text().notNull(), + cron: text(), + webhooks: boolean().notNull().default(false), config: json().$type>().notNull().default({}), memory: integer().notNull().default(128), timeout: integer().notNull().default(128),