fix: API V1 slots add explicit orgSlug null fallback (#16593)

* add explicit orgSlug null fallback

* do it in schema

* to nullish
This commit is contained in:
Syed Ali Shahbaz authored and GitHub committed 2024-09-11 16:14:03 +00:00
1 parent 2f2f4dba60
commit 89250422ea
4 files changed
+46 -4

No files matched your search

@@ -20,17 +20,20 @@ export const getScheduleSchema = z
.string()
.optional()
.transform((val) => val && parseInt(val)),
rescheduleUid: z.string().optional().nullable(),
rescheduleUid: z.string().nullish(),
// whether to do team event or user event
isTeamEvent: z.boolean().optional().default(false),
orgSlug: z.string().optional(),
teamMemberEmail: z.string().nullable().optional(),
orgSlug: z.string().nullish(),
teamMemberEmail: z.string().nullish(),
})
.transform((val) => {
// Need this so we can pass a single username in the query string form public API
if (val.usernameList) {
val.usernameList = Array.isArray(val.usernameList) ? val.usernameList : [val.usernameList];
}
if (!val.orgSlug) {
val.orgSlug = null;
}
return val;
})
.refine(