fix(schedule): give scheduleType a clean enum type for the host-access gate

createInsertSchema inferred scheduleType as a broadened union (drizzle-zod 0.5.1),
so passing input.scheduleType into assertHostScheduleAccess failed typecheck on a
cold build. Refine the insert schema's scheduleType to a plain z.enum and type the
helper param as the schedule enum.
This commit is contained in:
Mauricio Siu
2026-07-20 15:30:13 -06:00
parent 1e3f10bd22
commit 8fe3294a08
2 changed files with 10 additions and 2 deletions

View File

@@ -22,7 +22,7 @@ export type ScheduleExtended = Awaited<ReturnType<typeof findScheduleById>>;
// not downgrade this to a service-access check.
export const assertHostScheduleAccess = async (
ctx: { user: { id: string }; session: { activeOrganizationId: string } },
scheduleType: string | undefined,
scheduleType: Schedule["scheduleType"] | null | undefined,
serverId: string | null | undefined,
) => {
if (scheduleType !== "server" && scheduleType !== "dokploy-server") return;