Skip to content

Commit

Permalink
match connect
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewjeska committed Aug 23, 2023
1 parent 696b63d commit a4a84ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/pages/api/thermostats/climate_setting_schedules/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { withRouteSpec } from "lib/middleware/with-route-spec.ts"

const json_body = z.object({
climate_setting_schedule_id: z.string(),
device_id: z.string().optional(),
sync: z.boolean().default(false),
})

Expand All @@ -15,18 +14,17 @@ export default withRouteSpec({
jsonBody: json_body,
jsonResponse: z.object({}),
} as const)(async (req, res) => {
const { climate_setting_schedule_id, device_id } = req.body
const { climate_setting_schedule_id } = req.body

const climate_setting_schedule = req.db.findClimateSettingSchedule({
climate_setting_schedule_id,
device_id,
})

if (climate_setting_schedule == null) {
throw new NotFoundException({
type: "climate_setting_schedule_not_found",
message: `Could not find an climate_setting_schedule with device_id or climate_setting_schedule_id`,
data: { device_id, climate_setting_schedule_id },
message: `Could not find an climate_setting_schedule with climate_setting_schedule_id`,
data: { climate_setting_schedule_id },
})
}

Expand Down
5 changes: 3 additions & 2 deletions src/pages/api/thermostats/climate_setting_schedules/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ export default withRouteSpec({

if (climate_setting_schedule == null) {
throw new NotFoundException({
type: "not_found",
message: "Climate Setting Schedule Not Found",
type: "climate_setting_schedule_not_found",
message: `Could not find an climate_setting_schedule with climate_setting_schedule_id`,
data: { climate_setting_schedule_id },
})
}
res.status(200).json({ climate_setting_schedule })
Expand Down

0 comments on commit a4a84ec

Please sign in to comment.