calcom/lib/types/event-type.ts
Alex van Andel ffdf0b9217
Fixes user availability to be contextual to the user timezone (#1166)
* WIP, WIP, WIP, WIP

* Adds missing types

* Type fixes for useSlots

* Type fixes

* Fixes periodType 500 error when updating

* Adds missing dayjs plugin and type fixes

* An attempt was made to fix tests

* Save work in progress

* Added UTC overflow to days

* Update lib/availability.ts

Co-authored-by: Alex Johansson <alexander@n1s.se>

* No more magic numbers

* Fixed slots.test & added getWorkingHours.test

* Tests pass, simpler logic, profit?

* Timezone shifting!

* Forgot to unskip tests

* Updated the user page

* Added American seed user, some fixes

* tmp fix so to continue testing availability

* Removed timeZone parameter, fix defaultValue auto-scroll

Co-authored-by: Omar López <zomars@me.com>
Co-authored-by: Alex Johansson <alexander@n1s.se>
2021-11-18 01:03:19 +00:00

61 lines
1.4 KiB
TypeScript

import { EventType, SchedulingType } from "@prisma/client";
import { WorkingHours } from "./schedule";
export type AdvancedOptions = {
eventName?: string;
periodType?: string;
periodDays?: number;
periodStartDate?: Date | string;
periodEndDate?: Date | string;
periodCountCalendarDays?: boolean;
requiresConfirmation?: boolean;
disableGuests?: boolean;
minimumBookingNotice?: number;
price?: number;
currency?: string;
schedulingType?: SchedulingType;
users?: {
value: number;
label: string;
avatar: string;
}[];
availability?: { openingHours: WorkingHours[]; dateOverrides: WorkingHours[] };
customInputs?: EventTypeCustomInput[];
timeZone: string;
hidden: boolean;
};
export type EventTypeCustomInput = {
id: number;
label: string;
placeholder: string;
required: boolean;
type: string;
};
export type CreateEventType = {
title: string;
slug: string;
description: string;
length: number;
teamId?: number;
schedulingType?: SchedulingType;
};
export type CreateEventTypeResponse = {
eventType: EventType;
};
export type EventTypeInput = AdvancedOptions & {
id: number;
title: string;
slug: string;
description: string;
length: number;
hidden: boolean;
locations: unknown;
customInputs: EventTypeCustomInput[];
timeZone: string;
availability?: { openingHours: WorkingHours[]; dateOverrides: WorkingHours[] };
};