From 897ac5c61df8f65c80d1814a4ca5ddfa3656982f Mon Sep 17 00:00:00 2001 From: Michael Anderjaska Date: Thu, 10 Aug 2023 17:50:18 -0400 Subject: [PATCH] string template --- src/pages/api/thermostats/climate_setting_schedules/create.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/api/thermostats/climate_setting_schedules/create.ts b/src/pages/api/thermostats/climate_setting_schedules/create.ts index 23a937b7..aeba015f 100644 --- a/src/pages/api/thermostats/climate_setting_schedules/create.ts +++ b/src/pages/api/thermostats/climate_setting_schedules/create.ts @@ -4,6 +4,7 @@ import { withRouteSpec } from "lib/middleware/with-route-spec.ts" import { climate_setting } from "lib/zod/climate_setting.ts" import { climate_setting_schedule } from "lib/zod/climate_setting_schedule.ts" import { timestamp } from "lib/zod/common.ts" +import { randomUUID } from "crypto" const jsonBody = z .object({ @@ -49,7 +50,7 @@ export default withRouteSpec({ workspace_id: req.auth.workspace_id, schedule_type, device_id, - name: name ?? "Schedule ${randomUUID().slice(5)}", + name: name ?? `Schedule ${randomUUID().slice(5)}`, schedule_starts_at: new Date(schedule_starts_at).toISOString(), schedule_ends_at: new Date(schedule_ends_at).toISOString(), ...climate_setting_for_schedule,