first commit
This commit is contained in:
13
calcom/packages/lib/isBookingLimits.ts
Normal file
13
calcom/packages/lib/isBookingLimits.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { intervalLimitsType } from "@calcom/prisma/zod-utils";
|
||||
import type { IntervalLimit } from "@calcom/types/Calendar";
|
||||
|
||||
export function isBookingLimit(obj: unknown): obj is IntervalLimit {
|
||||
return intervalLimitsType.safeParse(obj).success;
|
||||
}
|
||||
|
||||
export function parseBookingLimit(obj: unknown): IntervalLimit | null {
|
||||
let bookingLimit: IntervalLimit | null = null;
|
||||
if (isBookingLimit(obj)) bookingLimit = obj;
|
||||
|
||||
return bookingLimit;
|
||||
}
|
||||
Reference in New Issue
Block a user