Fixes collective availability for teams with overlapping day timezones (#3898)
* WIP
* Fix for team availability with time offsets
* Prevent empty schedule from opening up everything
* When no utcOffset or timeZone's are given, default to 0 utcOffset (UTC)
* timeZone should not be part of getUserAvailability
* Prevents {days:[X],startTime:0,endTime:0} error entry
* Added getAggregateWorkingHours() (#3913)
* Added test for getAggregateWorkingHours
* Timezone isn't used here anymore
* fix: developer docs url (#3914)
* fix: developer docs url added
* chore : remove /
* chore : import url
Co-authored-by: Zach Waterfield <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
* Test fixes
* Reinstate prisma (generate only) and few comments
* Test fixes
* Skipping getSchedule again
* Added await to expect() as it involves async logic causing the promise to timeout
* Test cleanup
* Update jest.config.ts
Co-authored-by: Alan <[email protected]>
Co-authored-by: Alex van Andel <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: Zach Waterfield <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
15 files changed
+317
-181
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { Prisma, User, UserPlan } from "@prisma/client";
|
||||
|
||||
import { CalendarEvent, Person, VideoCallData } from "@calcom/types/Calendar";
|
||||
|
||||
@@ -44,3 +45,58 @@ export const buildCalendarEvent = (event?: Partial<CalendarEvent>): CalendarEven
|
||||
...event,
|
||||
};
|
||||
};
|
||||
|
||||
type UserPayload = Prisma.UserGetPayload<{
|
||||
include: {
|
||||
credentials: true;
|
||||
destinationCalendar: true;
|
||||
availability: true;
|
||||
selectedCalendars: true;
|
||||
schedules: true;
|
||||
};
|
||||
}>;
|
||||
export const buildUser = <T extends Partial<UserPayload>>(user?: T): UserPayload => {
|
||||
return {
|
||||
name: faker.name.firstName(),
|
||||
email: faker.internet.email(),
|
||||
timeZone: faker.address.timeZone(),
|
||||
username: faker.internet.userName(),
|
||||
id: 0,
|
||||
allowDynamicBooking: true,
|
||||
availability: [],
|
||||
avatar: "",
|
||||
away: false,
|
||||
bio: null,
|
||||
brandColor: "#292929",
|
||||
bufferTime: 0,
|
||||
completedOnboarding: false,
|
||||
createdDate: new Date(),
|
||||
credentials: [],
|
||||
darkBrandColor: "#fafafa",
|
||||
defaultScheduleId: null,
|
||||
destinationCalendar: null,
|
||||
disableImpersonation: false,
|
||||
emailVerified: null,
|
||||
endTime: 0,
|
||||
hideBranding: true,
|
||||
identityProvider: "CAL",
|
||||
identityProviderId: null,
|
||||
invitedTo: null,
|
||||
locale: "en",
|
||||
metadata: null,
|
||||
password: null,
|
||||
plan: UserPlan.PRO,
|
||||
role: "USER",
|
||||
schedules: [],
|
||||
selectedCalendars: [],
|
||||
startTime: 0,
|
||||
theme: null,
|
||||
timeFormat: null,
|
||||
trialEndsAt: null,
|
||||
twoFactorEnabled: false,
|
||||
twoFactorSecret: null,
|
||||
verified: false,
|
||||
weekStart: "",
|
||||
...user,
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user