Recurring event fixes (#3030)
* Incorporates recurringEvent into calEvent * Recurrent event fixes * Update event.ts * type fixes * Update zod-utils.ts * Adding more recurringEvent to calEvent and other fixes * Moving away from heavy 3rd party enum * Fixing test * Renaming as suggested and fixes Co-authored-by: Leo Giovanetti <[email protected]>
This commit is contained in:
1 parent
8cd420173c
commit
b11398f551
55 files changed
+315
-333
No files matched your search
@@ -58,7 +58,7 @@ const commons = {
|
||||
},
|
||||
isWeb3Active: false,
|
||||
hideCalendarNotes: false,
|
||||
recurringEvent: {},
|
||||
recurringEvent: null,
|
||||
destinationCalendar: null,
|
||||
team: null,
|
||||
requiresConfirmation: false,
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
export { default as isPrismaObj, isPrismaObjOrUndefined } from "./isPrismaObj";
|
||||
export * from "./isRecurringEvent";
|
||||
@@ -0,0 +1,13 @@
|
||||
import { recurringEventType as recurringEventSchema } from "@calcom/prisma/zod-utils";
|
||||
import type { RecurringEvent } from "@calcom/types/Calendar";
|
||||
|
||||
export function isRecurringEvent(obj: unknown): obj is RecurringEvent {
|
||||
const parsedRecuEvt = recurringEventSchema.safeParse(obj);
|
||||
return parsedRecuEvt.success;
|
||||
}
|
||||
|
||||
export function parseRecurringEvent(obj: unknown): RecurringEvent | null {
|
||||
let recurringEvent: RecurringEvent | null = null;
|
||||
if (isRecurringEvent(obj)) recurringEvent = obj;
|
||||
return recurringEvent;
|
||||
}
|
||||
Reference in new issue
Block a user