2022-08-11 00:53:05 +00:00
|
|
|
import { faker } from "@faker-js/faker";
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { Booking, EventType, Prisma, Webhook } from "@prisma/client";
|
2023-06-22 22:25:37 +00:00
|
|
|
import type { TFunction } from "next-i18next";
|
2022-08-11 00:53:05 +00:00
|
|
|
|
2023-05-02 11:44:05 +00:00
|
|
|
import { BookingStatus } from "@calcom/prisma/enums";
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { CalendarEvent, Person, VideoCallData } from "@calcom/types/Calendar";
|
2022-08-11 00:53:05 +00:00
|
|
|
|
|
|
|
export const buildVideoCallData = (callData?: Partial<VideoCallData>): VideoCallData => {
|
|
|
|
return {
|
|
|
|
type: faker.helpers.arrayElement(["zoom_video", "stream_video"]),
|
|
|
|
id: faker.datatype.uuid(),
|
|
|
|
password: faker.internet.password(),
|
|
|
|
url: faker.internet.url(),
|
|
|
|
...callData,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const buildPerson = (person?: Partial<Person>): Person => {
|
|
|
|
return {
|
|
|
|
name: faker.name.firstName(),
|
|
|
|
email: faker.internet.email(),
|
|
|
|
timeZone: faker.address.timeZone(),
|
|
|
|
username: faker.internet.userName(),
|
2022-10-18 19:41:50 +00:00
|
|
|
id: faker.datatype.number(),
|
2022-08-11 00:53:05 +00:00
|
|
|
language: {
|
|
|
|
locale: faker.random.locale(),
|
2023-06-22 22:25:37 +00:00
|
|
|
translate: ((key: string) => key) as TFunction,
|
2022-08-11 00:53:05 +00:00
|
|
|
},
|
|
|
|
...person,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-10-06 19:29:20 +00:00
|
|
|
export const buildBooking = (booking?: Partial<Booking>): Booking => {
|
|
|
|
return {
|
|
|
|
id: faker.datatype.number(),
|
|
|
|
uid: faker.datatype.uuid(),
|
|
|
|
userId: null,
|
|
|
|
eventTypeId: null,
|
|
|
|
title: faker.lorem.sentence(),
|
|
|
|
description: faker.lorem.paragraph(),
|
|
|
|
customInputs: null,
|
|
|
|
startTime: faker.date.future(),
|
|
|
|
endTime: faker.date.future(),
|
|
|
|
location: null,
|
|
|
|
createdAt: new Date(),
|
|
|
|
updatedAt: null,
|
|
|
|
status: BookingStatus.ACCEPTED,
|
|
|
|
paid: false,
|
|
|
|
destinationCalendarId: null,
|
|
|
|
cancellationReason: null,
|
|
|
|
rejectionReason: null,
|
|
|
|
dynamicEventSlugRef: null,
|
|
|
|
dynamicGroupSlugRef: null,
|
|
|
|
rescheduled: null,
|
|
|
|
fromReschedule: null,
|
|
|
|
recurringEventId: null,
|
|
|
|
smsReminderNumber: null,
|
|
|
|
scheduledJobs: [],
|
2022-12-15 21:43:07 +00:00
|
|
|
metadata: null,
|
2023-03-02 18:15:28 +00:00
|
|
|
responses: null,
|
2023-04-13 19:07:10 +00:00
|
|
|
isRecorded: false,
|
2022-10-06 19:29:20 +00:00
|
|
|
...booking,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const buildEventType = (eventType?: Partial<EventType>): EventType => {
|
|
|
|
return {
|
|
|
|
id: faker.datatype.number(),
|
|
|
|
title: faker.lorem.sentence(),
|
|
|
|
slug: faker.lorem.slug(),
|
|
|
|
description: faker.lorem.paragraph(),
|
|
|
|
position: 1,
|
|
|
|
locations: null,
|
|
|
|
length: 15,
|
2023-05-17 11:56:55 +00:00
|
|
|
offsetStart: 0,
|
2022-10-06 19:29:20 +00:00
|
|
|
hidden: false,
|
|
|
|
userId: null,
|
|
|
|
teamId: null,
|
2023-07-31 17:51:11 +00:00
|
|
|
requiresBookerEmailVerification: false,
|
2022-10-06 19:29:20 +00:00
|
|
|
eventName: faker.lorem.words(),
|
|
|
|
timeZone: null,
|
|
|
|
periodType: "UNLIMITED",
|
|
|
|
periodStartDate: null,
|
|
|
|
periodEndDate: null,
|
|
|
|
periodDays: null,
|
|
|
|
periodCountCalendarDays: null,
|
|
|
|
recurringEvent: null,
|
|
|
|
requiresConfirmation: false,
|
|
|
|
disableGuests: false,
|
|
|
|
hideCalendarNotes: false,
|
|
|
|
minimumBookingNotice: 120,
|
|
|
|
beforeEventBuffer: 0,
|
|
|
|
afterEventBuffer: 0,
|
|
|
|
seatsPerTimeSlot: null,
|
2022-10-18 19:41:50 +00:00
|
|
|
seatsShowAttendees: null,
|
2023-09-08 15:37:26 +00:00
|
|
|
seatsShowAvailabilityCount: null,
|
2022-10-06 19:29:20 +00:00
|
|
|
schedulingType: null,
|
|
|
|
scheduleId: null,
|
2022-10-12 05:29:04 +00:00
|
|
|
bookingLimits: null,
|
2023-03-10 20:00:19 +00:00
|
|
|
durationLimits: null,
|
2022-10-06 19:29:20 +00:00
|
|
|
price: 0,
|
|
|
|
currency: "usd",
|
|
|
|
slotInterval: null,
|
|
|
|
metadata: null,
|
|
|
|
successRedirectUrl: null,
|
2023-04-13 02:10:23 +00:00
|
|
|
bookingFields: [],
|
|
|
|
parentId: null,
|
2022-10-06 19:29:20 +00:00
|
|
|
...eventType,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const buildWebhook = (webhook?: Partial<Webhook>): Webhook => {
|
|
|
|
return {
|
|
|
|
id: faker.datatype.uuid(),
|
|
|
|
eventTypeId: faker.datatype.number(),
|
|
|
|
subscriberUrl: "http://mockedURL.com",
|
|
|
|
payloadTemplate: null,
|
|
|
|
createdAt: faker.datatype.datetime(),
|
|
|
|
appId: null,
|
|
|
|
userId: null,
|
|
|
|
secret: faker.lorem.slug(),
|
|
|
|
active: true,
|
|
|
|
eventTriggers: [],
|
2023-05-23 01:15:29 +00:00
|
|
|
teamId: null,
|
2022-10-06 19:29:20 +00:00
|
|
|
...webhook,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const buildSubscriberEvent = (booking?: Partial<Booking>) => {
|
|
|
|
return {
|
|
|
|
type: booking?.title || "",
|
|
|
|
title: booking?.title,
|
|
|
|
description: "",
|
|
|
|
additionalNotes: "",
|
|
|
|
customInputs: {},
|
|
|
|
startTime: booking?.startTime,
|
|
|
|
endTime: booking?.endTime,
|
|
|
|
organizer: {
|
|
|
|
name: "",
|
|
|
|
email: "",
|
|
|
|
timeZone: "",
|
|
|
|
language: {
|
|
|
|
locale: "en",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
attendees: [],
|
|
|
|
location: "",
|
|
|
|
destinationCalendar: null,
|
|
|
|
hideCalendar: false,
|
|
|
|
uid: booking?.uid,
|
|
|
|
metadata: {},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-08-11 00:53:05 +00:00
|
|
|
export const buildCalendarEvent = (event?: Partial<CalendarEvent>): CalendarEvent => {
|
|
|
|
return {
|
|
|
|
uid: faker.datatype.uuid(),
|
|
|
|
type: faker.helpers.arrayElement(["event", "meeting"]),
|
|
|
|
title: faker.lorem.sentence(),
|
|
|
|
startTime: faker.date.future().toISOString(),
|
|
|
|
endTime: faker.date.future().toISOString(),
|
|
|
|
location: faker.address.city(),
|
|
|
|
description: faker.lorem.paragraph(),
|
|
|
|
attendees: [],
|
|
|
|
customInputs: {},
|
|
|
|
additionalNotes: faker.lorem.paragraph(),
|
|
|
|
organizer: buildPerson(),
|
|
|
|
videoCallData: buildVideoCallData(),
|
|
|
|
...event,
|
|
|
|
};
|
|
|
|
};
|
2022-08-22 23:53:51 +00:00
|
|
|
|
|
|
|
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,
|
2023-08-30 07:33:48 +00:00
|
|
|
backupCodes: null,
|
2022-08-22 23:53:51 +00:00
|
|
|
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,
|
|
|
|
role: "USER",
|
|
|
|
schedules: [],
|
|
|
|
selectedCalendars: [],
|
|
|
|
startTime: 0,
|
|
|
|
theme: null,
|
|
|
|
timeFormat: null,
|
|
|
|
trialEndsAt: null,
|
|
|
|
twoFactorEnabled: false,
|
|
|
|
twoFactorSecret: null,
|
|
|
|
verified: false,
|
|
|
|
weekStart: "",
|
feat: Organizations (#8993)
* Initial commit
* Adding feature flag
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* Letting duplicate slugs for teams to support orgs
* Covering null on unique clauses
* Supporting having the orgId in the session cookie
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Making sure we let localhost still work
* Feedback
* Type check fixes
* feat: Organization branding in side menu (#9279)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Making sure we show the set up profile on org only
* Profile username availability rely on org hook
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: Organization support for event types page (#9449)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Processing orgs and children as profile options
* Reverting change not belonging to this PR
* Making sure we show the set up profile on org only
* Removing console.log
* Comparing memberships to choose the highest one
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Type errors
* Refactor and type fixes
* Update orgDomains.ts
* Feedback
* Reverting
* NIT
* fix issue getting org slug from domain
* Improving orgDomains util
* Host comes with port
* Update useRouterQuery.ts
* Feedback
* Feedback
* Feedback
* Feedback: SSR for user event-types to have org context
* chore: Cache node_modules (#9492)
* Adding check for cache hit
* Adding a separate install step first
* Put the restore cache steps back
* Revert the uses type for restoring cache
* Added step to restore nm cache
* Removed the cache-hit check
* Comments and naming
* Removed extra install command
* Updated the name of the linting step to be more clear
* Removes the need for useEffect here
* Feedback
* Feedback
* Cookie domain needs a dot
* Type fix
* Update apps/web/public/static/locales/en/common.json
Co-authored-by: Omar López <zomars@me.com>
* Update packages/emails/src/templates/OrganizationAccountVerifyEmail.tsx
* Feedback
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Efraín Rochín <roae.85@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2023-06-14 21:40:20 +00:00
|
|
|
organizationId: null,
|
2023-08-15 00:44:09 +00:00
|
|
|
allowSEOIndexing: null,
|
2022-08-22 23:53:51 +00:00
|
|
|
...user,
|
|
|
|
};
|
|
|
|
};
|