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:
Omar LópezandLeo Giovanetti authored and GitHub committed 2022-06-09 18:32:34 -06:00
1 parent 8cd420173c
commit b11398f551
55 files changed
+315 -333

No files matched your search

+1 -1
View File
@@ -58,7 +58,7 @@ const commons = {
},
isWeb3Active: false,
hideCalendarNotes: false,
recurringEvent: {},
recurringEvent: null,
destinationCalendar: null,
team: null,
requiresConfirmation: false,
+1
View File
@@ -1 +1,2 @@
export { default as isPrismaObj, isPrismaObjOrUndefined } from "./isPrismaObj";
export * from "./isRecurringEvent";
+13
View File
@@ -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;
}