feat: add recurringEvent attribute to api/v2/event-types (#16251)

* feat: added recurringEvent attribute to api/v2/event-types

* changed `recurringEvent` to `recurrence`

* Update CHANGELOG.md

* remove /dist/ import

* change `as` to `satisfies`

* testing some changes

* Revert "testing some changes"

This reverts commit 464d2611ed19dbd6ae390332b4d6dd5884bcae3b.

* Update recurrence.input.ts

* fix: apiv2 tsconfig enums

* Update CHANGELOG.md

* removed dev imports

* Update package.json

* Update api-request.spec.ts

* Update api-request.spec.ts

* added recurrence to update-event-type.input

---------

Co-authored-by: Morgan Vernay <morgan@cal.com>
This commit is contained in:
Somay Chauhan
2024-08-26 11:42:35 +03:00
committed by GitHub
co-authored by Morgan Vernay
parent 03051a2bb1
commit ef11755488
25 changed files with 512 additions and 102 deletions
+2 -2
View File
@@ -10,7 +10,7 @@
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"dev:build:watch": "yarn workspace @calcom/platform-constants build:watch & yarn workspace @calcom/platform-utils build:watch & yarn workspace @calcom/platform-types build:watch",
"dev:build": "yarn workspace @calcom/platform-constants build && yarn workspace @calcom/platform-utils build && yarn workspace @calcom/platform-types build && yarn workspace @calcom/platform-enums build",
"dev:build": "yarn workspace @calcom/platform-constants build && yarn workspace @calcom/platform-enums build && yarn workspace @calcom/platform-utils build && yarn workspace @calcom/platform-types build ",
"dev": "yarn dev:build && docker-compose up -d && yarn copy-swagger-module && yarn start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node ./dist/apps/api/v2/src/main.js",
@@ -26,7 +26,7 @@
"dependencies": {
"@calcom/platform-constants": "*",
"@calcom/platform-enums": "*",
"@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.28",
"@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.30",
"@calcom/platform-libraries-0.0.2": "npm:@calcom/platform-libraries@0.0.2",
"@calcom/platform-types": "*",
"@calcom/platform-utils": "*",
@@ -20,7 +20,7 @@ import { UserRepositoryFixture } from "test/fixtures/repository/users.repository
import { withApiAuth } from "test/utils/withApiAuth";
import { CAL_API_VERSION_HEADER, SUCCESS_STATUS, VERSION_2024_06_14 } from "@calcom/platform-constants";
import { BookingWindowPeriodInputTypeEnum_2024_06_14 } from "@calcom/platform-enums";
import { BookingWindowPeriodInputTypeEnum_2024_06_14, FrequencyInput } from "@calcom/platform-enums";
import {
ApiSuccessResponse,
CreateEventTypeInput_2024_06_14,
@@ -230,6 +230,11 @@ describe("Event types Endpoints", () => {
value: 30,
rolling: true,
},
recurrence: {
frequency: FrequencyInput.weekly,
interval: 2,
occurrences: 10,
},
};
return request(app.getHttpServer())
@@ -253,6 +258,7 @@ describe("Event types Endpoints", () => {
expect(createdEventType.bookingLimitsDuration).toEqual(body.bookingLimitsDuration);
expect(createdEventType.offsetStart).toEqual(body.offsetStart);
expect(createdEventType.bookingWindow).toEqual(body.bookingWindow);
expect(createdEventType.recurrence).toEqual(body.recurrence);
eventType = responseBody.data;
});
});
@@ -278,6 +284,11 @@ describe("Event types Endpoints", () => {
value: 40,
rolling: false,
},
recurrence: {
frequency: FrequencyInput.monthly,
interval: 4,
occurrences: 10,
},
};
return request(app.getHttpServer())
@@ -303,6 +314,7 @@ describe("Event types Endpoints", () => {
expect(updatedEventType.bookingLimitsDuration).toEqual(body.bookingLimitsDuration);
expect(updatedEventType.offsetStart).toEqual(body.offsetStart);
expect(updatedEventType.bookingWindow).toEqual(body.bookingWindow);
expect(updatedEventType.recurrence).toEqual(body.recurrence);
eventType.title = newTitle;
eventType.scheduleId = secondSchedule.id;
@@ -311,6 +323,7 @@ describe("Event types Endpoints", () => {
eventType.bookingLimitsDuration = updatedEventType.bookingLimitsDuration;
eventType.offsetStart = updatedEventType.offsetStart;
eventType.bookingWindow = updatedEventType.bookingWindow;
eventType.recurrence = updatedEventType.recurrence;
});
});
@@ -351,6 +364,7 @@ describe("Event types Endpoints", () => {
expect(fetchedEventType.bookingLimitsDuration).toEqual(eventType.bookingLimitsDuration);
expect(fetchedEventType.offsetStart).toEqual(eventType.offsetStart);
expect(fetchedEventType.bookingWindow).toEqual(eventType.bookingWindow);
expect(fetchedEventType.recurrence).toEqual(eventType.recurrence);
});
it(`/GET/even-types by username`, async () => {
@@ -381,6 +395,7 @@ describe("Event types Endpoints", () => {
expect(fetchedEventType.bookingLimitsDuration).toEqual(eventType.bookingLimitsDuration);
expect(fetchedEventType.offsetStart).toEqual(eventType.offsetStart);
expect(fetchedEventType.bookingWindow).toEqual(eventType.bookingWindow);
expect(fetchedEventType.recurrence).toEqual(eventType.recurrence);
});
it(`/GET/event-types by username and eventSlug`, async () => {
@@ -406,6 +421,7 @@ describe("Event types Endpoints", () => {
expect(fetchedEventType.bookingLimitsDuration).toEqual(eventType.bookingLimitsDuration);
expect(fetchedEventType.offsetStart).toEqual(eventType.offsetStart);
expect(fetchedEventType.bookingWindow).toEqual(eventType.bookingWindow);
expect(fetchedEventType.recurrence).toEqual(eventType.recurrence);
});
it(`/GET/:id not existing`, async () => {
@@ -26,6 +26,7 @@ type InputEventTransformed = Omit<
| "periodCountCalendarDays"
| "periodStartDate"
| "periodEndDate"
| "recurrence"
> & {
length: number;
slug: string;
@@ -46,6 +46,7 @@ export class EventTypesService_2024_06_14 {
periodCountCalendarDays = undefined,
periodStartDate = undefined,
periodEndDate = undefined,
recurrence = undefined,
...bodyTransformed
} = this.inputEventTypesService.transformInputCreateEventType(body);
const { eventType: eventTypeCreated } = await createEventType({
@@ -68,6 +69,7 @@ export class EventTypesService_2024_06_14 {
periodCountCalendarDays,
periodStartDate,
periodEndDate,
recurrence,
...bodyTransformed,
},
ctx: {
@@ -5,6 +5,7 @@ import {
transformApiEventTypeLocations,
transformApiEventTypeIntervalLimits,
transformApiEventTypeFutureBookingLimits,
transformApiEventTypeRecurrence,
} from "@calcom/platform-libraries";
import { CreateEventTypeInput_2024_06_14, UpdateEventTypeInput_2024_06_14 } from "@calcom/platform-types";
@@ -25,6 +26,7 @@ export class InputEventTypesService_2024_06_14 {
bookingLimitsCount,
bookingLimitsDuration,
bookingWindow,
recurrence,
...rest
} = inputEventType;
@@ -38,6 +40,7 @@ export class InputEventTypesService_2024_06_14 {
? this.transformInputIntervalLimits(bookingLimitsDuration)
: undefined,
...this.transformInputBookingWindow(bookingWindow),
recurringEvent: recurrence ? this.transformInputRecurrignEvent(recurrence) : undefined,
};
return eventType;
@@ -52,6 +55,7 @@ export class InputEventTypesService_2024_06_14 {
bookingLimitsCount,
bookingLimitsDuration,
bookingWindow,
recurrence,
...rest
} = inputEventType;
@@ -66,6 +70,7 @@ export class InputEventTypesService_2024_06_14 {
? this.transformInputIntervalLimits(bookingLimitsDuration)
: undefined,
...this.transformInputBookingWindow(bookingWindow),
recurringEvent: recurrence ? this.transformInputRecurrignEvent(recurrence) : undefined,
};
return eventType;
@@ -87,4 +92,8 @@ export class InputEventTypesService_2024_06_14 {
const res = transformApiEventTypeFutureBookingLimits(inputBookingWindow);
return !!res ? res : {};
}
transformInputRecurrignEvent(recurrence: CreateEventTypeInput_2024_06_14["recurrence"]) {
return transformApiEventTypeRecurrence(recurrence);
}
}
@@ -14,6 +14,7 @@ import {
parseBookingLimit,
getResponseEventTypeIntervalLimits,
getResponseEventTypeFutureBookingLimits,
getResponseEventTypeRecurrence,
} from "@calcom/platform-libraries";
import { TransformFutureBookingsLimitSchema_2024_06_14 } from "@calcom/platform-types";
@@ -92,7 +93,7 @@ export class OutputEventTypesService_2024_06_14 {
const bookingFields = databaseEventType.bookingFields
? this.transformBookingFields(BookingFieldsSchema.parse(databaseEventType.bookingFields))
: [];
const recurringEvent = this.transformRecurringEvent(databaseEventType.recurringEvent);
const recurrence = this.transformRecurringEvent(databaseEventType.recurringEvent);
const metadata = this.transformMetadata(databaseEventType.metadata) || {};
const users = this.transformUsers(databaseEventType.users);
const bookingLimitsCount = this.transformIntervalLimits(databaseEventType.bookingLimits);
@@ -114,7 +115,7 @@ export class OutputEventTypesService_2024_06_14 {
description: description || "",
locations,
bookingFields,
recurringEvent,
recurrence,
disableGuests,
slotInterval,
minimumBookingNotice,
@@ -154,7 +155,8 @@ export class OutputEventTypesService_2024_06_14 {
transformRecurringEvent(recurringEvent: any) {
if (!recurringEvent) return null;
return parseRecurringEvent(recurringEvent);
const recurringEventParsed = parseRecurringEvent(recurringEvent);
return getResponseEventTypeRecurrence(recurringEventParsed);
}
transformMetadata(metadata: any) {
@@ -30,6 +30,7 @@ export class InputOrganizationsEventTypesService {
bookingLimitsDuration,
bookingWindow,
bookingFields,
recurrence,
...rest
} = inputEventType;
@@ -47,6 +48,7 @@ export class InputOrganizationsEventTypesService {
bookingLimitsDuration,
bookingWindow,
bookingFields,
recurrence,
metadata,
};
@@ -47,6 +47,7 @@ export class OrganizationsEventTypesService {
bookingLimitsDuration,
bookingWindow,
bookingFields,
recurrence,
...rest
} = await this.inputService.transformInputCreateTeamEventType(teamId, body);
const { eventType: eventTypeCreated } = await createEventType({
@@ -69,6 +70,7 @@ export class OrganizationsEventTypesService {
bookingLimitsDuration,
bookingWindow,
bookingFields,
recurrence,
...rest,
},
user
+226 -30
View File
@@ -1219,6 +1219,16 @@
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateScheduleInput_2024_06_11"
}
}
}
},
"responses": {
"201": {
"description": "",
@@ -1321,6 +1331,16 @@
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateScheduleInput_2024_06_11"
}
}
}
},
"responses": {
"200": {
"description": "",
@@ -2360,6 +2380,16 @@
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateScheduleInput_2024_04_15"
}
}
}
},
"responses": {
"200": {
"description": "",
@@ -6079,6 +6109,57 @@
"data"
]
},
"CreateScheduleInput_2024_06_11": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "One-on-one coaching"
},
"timeZone": {
"type": "string",
"example": "Europe/Rome"
},
"availability": {
"example": [
{
"days": [
"Monday",
"Tuesday"
],
"startTime": "09:00",
"endTime": "10:00"
}
],
"type": "array",
"items": {
"$ref": "#/components/schemas/ScheduleAvailabilityInput_2024_06_11"
}
},
"isDefault": {
"type": "boolean",
"example": true
},
"overrides": {
"example": [
{
"date": "2024-05-20",
"startTime": "12:00",
"endTime": "14:00"
}
],
"type": "array",
"items": {
"$ref": "#/components/schemas/ScheduleOverrideInput_2024_06_11"
}
}
},
"required": [
"name",
"timeZone",
"isDefault"
]
},
"CreateScheduleOutput_2024_06_11": {
"type": "object",
"properties": {
@@ -6127,6 +6208,52 @@
"data"
]
},
"UpdateScheduleInput_2024_06_11": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "One-on-one coaching"
},
"timeZone": {
"type": "string",
"example": "Europe/Rome"
},
"availability": {
"example": [
{
"days": [
"Monday",
"Tuesday"
],
"startTime": "09:00",
"endTime": "10:00"
}
],
"type": "array",
"items": {
"$ref": "#/components/schemas/ScheduleAvailabilityInput_2024_06_11"
}
},
"isDefault": {
"type": "boolean",
"example": true
},
"overrides": {
"example": [
{
"date": "2024-05-20",
"startTime": "12:00",
"endTime": "14:00"
}
],
"type": "array",
"items": {
"$ref": "#/components/schemas/ScheduleOverrideInput_2024_06_11"
}
}
}
},
"UpdateScheduleOutput_2024_06_11": {
"type": "object",
"properties": {
@@ -6689,43 +6816,32 @@
"data"
]
},
"RecurringEvent_2024_06_14": {
"Recurrence_2024_06_14": {
"type": "object",
"properties": {
"dtstart": {
"format": "date-time",
"type": "string"
},
"interval": {
"type": "number"
},
"count": {
"type": "number"
},
"freq": {
"type": "number",
"example": 10,
"description": "Repeats every {count} week | month | year"
},
"occurrences": {
"type": "number",
"example": 10,
"description": "Repeats for a maximum of {count} events"
},
"frequency": {
"enum": [
0,
1,
2,
3,
4,
5,
6
]
},
"until": {
"format": "date-time",
"type": "string"
},
"tzid": {
"yearly",
"monthly",
"weekly"
],
"type": "string"
}
},
"required": [
"interval",
"count",
"freq"
"occurrences",
"frequency"
]
},
"TeamEventTypeResponseHost": {
@@ -6862,11 +6978,11 @@
"type": "object",
"nullable": true
},
"recurringEvent": {
"recurrence": {
"nullable": true,
"allOf": [
{
"$ref": "#/components/schemas/RecurringEvent_2024_06_14"
"$ref": "#/components/schemas/Recurrence_2024_06_14"
}
]
},
@@ -6956,7 +7072,7 @@
"bookingFields",
"disableGuests",
"schedulingType",
"recurringEvent",
"recurrence",
"metadata",
"requiresConfirmation",
"price",
@@ -7261,6 +7377,26 @@
"userId"
]
},
"GetDefaultScheduleOutput_2024_06_11": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "success",
"enum": [
"success",
"error"
]
},
"data": {
"$ref": "#/components/schemas/ScheduleOutput_2024_06_11"
}
},
"required": [
"status",
"data"
]
},
"CreateAvailabilityInput_2024_04_15": {
"type": "object",
"properties": {
@@ -7558,6 +7694,66 @@
"data"
]
},
"UpdateScheduleInput_2024_04_15": {
"type": "object",
"properties": {
"timeZone": {
"type": "string"
},
"name": {
"type": "string"
},
"isDefault": {
"type": "boolean"
},
"schedule": {
"example": [
[],
[
{
"start": "2022-01-01T00:00:00.000Z",
"end": "2022-01-02T00:00:00.000Z"
}
],
[],
[],
[],
[],
[]
],
"items": {
"type": "array"
},
"type": "array"
},
"dateOverrides": {
"example": [
[],
[
{
"start": "2022-01-01T00:00:00.000Z",
"end": "2022-01-02T00:00:00.000Z"
}
],
[],
[],
[],
[],
[]
],
"items": {
"type": "array"
},
"type": "array"
}
},
"required": [
"timeZone",
"name",
"isDefault",
"schedule"
]
},
"EventTypeModel_2024_04_15": {
"type": "object",
"properties": {
+2 -1
View File
@@ -17,7 +17,8 @@
"@prisma/client/*": ["@calcom/prisma/client/*"],
"@calcom/platform-constants": ["../../../packages/platform/constants/index.ts"],
"@calcom/platform-types": ["../../../packages/platform/types/index.ts"],
"@calcom/platform-utils": ["../../../packages/platform/utils/index.ts"]
"@calcom/platform-utils": ["../../../packages/platform/utils/index.ts"],
"@calcom/platform-enums": ["../../../packages/platform/enums/index.ts"]
},
"incremental": true,
"skipLibCheck": true,
@@ -15,7 +15,7 @@ export const substituteVariables = (
variables.forEach((variable) => {
for (const key in response) {
const field = fields.find((field) => field.id === key)
const field = fields.find((field) => field.id === key);
if (!field) {
continue;
}
@@ -1,10 +1,12 @@
import { describe, expect, it } from "vitest";
import { FrequencyInput } from "@calcom/platform-enums/monorepo";
import type {
BookingField_2024_06_14,
Location_2024_06_14,
BookingLimitsCount_2024_06_14,
BookingWindow_2024_06_14,
Recurrence_2024_06_14,
} from "@calcom/platform-types";
import type { UserField } from "./api-request";
@@ -14,6 +16,7 @@ import {
transformSelectOptions,
transformApiEventTypeIntervalLimits,
transformApiEventTypeFutureBookingLimits,
transformApiEventTypeRecurrence,
} from "./api-request";
describe("transformApiEventTypeLocations", () => {
@@ -653,3 +656,21 @@ describe("transformApiEventTypeFutureBookingLimits", () => {
expect(result).toEqual(expectedOutput);
});
});
describe("transformApiEventTypeRecurrence", () => {
it("should transform recurrence", () => {
const input: Recurrence_2024_06_14 = {
frequency: FrequencyInput.weekly,
interval: 2,
occurrences: 10,
};
const expectedOutput = {
interval: 2,
count: 10,
freq: 2,
};
const result = transformApiEventTypeRecurrence(input);
expect(result).toEqual(expectedOutput);
});
});
@@ -4,6 +4,7 @@ import {
BookingWindowPeriodInputTypeEnum_2024_06_14,
BookingWindowPeriodOutputTypeEnum_2024_06_14,
BookingLimitsEnum_2024_06_14,
Frequency,
} from "@calcom/platform-enums/monorepo";
import {
type CreateEventTypeInput_2024_06_14,
@@ -13,6 +14,7 @@ import {
type TransformFutureBookingsLimitSchema_2024_06_14,
type BookingLimitsKeyOutputType_2024_06_14,
type TransformBookingLimitsSchema_2024_06_14,
type TransformRecurringEventSchema_2024_06_14,
} from "@calcom/platform-types";
const integrationsMapping: Record<Integration_2024_06_14, string> = {
@@ -123,7 +125,7 @@ function transformApiEventTypeIntervalLimits(
Object.entries(inputBookingLimits).map(([key, value]) => {
const outputKey: BookingLimitsKeyOutputType_2024_06_14 = BookingLimitsEnum_2024_06_14[
key as keyof typeof BookingLimitsEnum_2024_06_14
] as BookingLimitsKeyOutputType_2024_06_14;
] satisfies BookingLimitsKeyOutputType_2024_06_14;
res[outputKey] = value;
});
return res;
@@ -160,6 +162,17 @@ function transformApiEventTypeFutureBookingLimits(
}
}
function transformApiEventTypeRecurrence(
recurrence: CreateEventTypeInput_2024_06_14["recurrence"]
): TransformRecurringEventSchema_2024_06_14 | undefined {
if (!recurrence) return undefined;
return {
interval: recurrence.interval,
count: recurrence.occurrences,
freq: Frequency[recurrence.frequency as keyof typeof Frequency],
} satisfies TransformRecurringEventSchema_2024_06_14;
}
export function transformSelectOptions(options: string[]) {
return options.map((option) => ({
label: option,
@@ -262,4 +275,5 @@ export {
transformApiEventTypeBookingFields,
transformApiEventTypeIntervalLimits,
transformApiEventTypeFutureBookingLimits,
transformApiEventTypeRecurrence,
};
@@ -7,6 +7,7 @@ import type {
IntegrationLocation_2024_06_14,
TransformBookingLimitsSchema_2024_06_14,
TransformFutureBookingsLimitSchema_2024_06_14,
TransformRecurringEventSchema_2024_06_14,
} from "@calcom/platform-types";
import type { UserField } from "./api-request";
@@ -15,6 +16,7 @@ import {
getResponseEventTypeBookingFields,
getResponseEventTypeIntervalLimits,
getResponseEventTypeFutureBookingLimits,
getResponseEventTypeRecurrence,
} from "./api-response";
describe("getResponseEventTypeLocations", () => {
@@ -574,7 +576,7 @@ describe("getResponseEventTypeBookingFields", () => {
});
});
describe("transformApiEventTypeIntervalLimits", () => {
describe("getResponseEventTypeIntervalLimits", () => {
it("should reverse transform booking limits count or booking limits duration", () => {
const transformedField: TransformBookingLimitsSchema_2024_06_14 = {
PER_DAY: 2,
@@ -595,7 +597,7 @@ describe("transformApiEventTypeIntervalLimits", () => {
});
});
describe("transformApiEventTypeFutureBookingLimits", () => {
describe("getResponseEventTypeFutureBookingLimits", () => {
it("should reverse transform range type", () => {
const transformedField: TransformFutureBookingsLimitSchema_2024_06_14 = {
periodType: "RANGE",
@@ -679,3 +681,22 @@ describe("transformApiEventTypeFutureBookingLimits", () => {
expect(result).toEqual(expectedOutput);
});
});
describe("getResponseEventTypeRecurrence", () => {
it("should reverse transform recurringEvent", () => {
const transformedField: TransformRecurringEventSchema_2024_06_14 = {
interval: 2,
count: 10,
freq: 2,
};
const expectedOutput = {
frequency: "weekly",
interval: 2,
occurrences: 10,
};
const result = getResponseEventTypeRecurrence(transformedField);
expect(result).toEqual(expectedOutput);
});
});
@@ -2,6 +2,8 @@ import {
BookingWindowPeriodInputTypeEnum_2024_06_14,
BookingWindowPeriodOutputTypeEnum_2024_06_14,
BookingLimitsEnum_2024_06_14,
Frequency,
FrequencyInput,
} from "@calcom/platform-enums/monorepo";
import type {
AddressLocation_2024_06_14,
@@ -17,6 +19,8 @@ import type {
CalendarDaysWindow_2024_06_14,
BusinessDaysWindow_2024_06_14,
BookingField_2024_06_14,
Recurrence_2024_06_14,
TransformRecurringEventSchema_2024_06_14,
} from "@calcom/platform-types";
import type { transformApiEventTypeBookingFields, transformApiEventTypeLocations } from "./api-request";
@@ -255,9 +259,21 @@ function getResponseEventTypeFutureBookingLimits(
return undefined;
}
}
function getResponseEventTypeRecurrence(
transformRecurringEvent: TransformRecurringEventSchema_2024_06_14
): Recurrence_2024_06_14 {
return {
interval: transformRecurringEvent.interval,
occurrences: transformRecurringEvent.count,
frequency: FrequencyInput[Frequency[transformRecurringEvent.freq] as keyof typeof FrequencyInput],
} satisfies Recurrence_2024_06_14;
}
export {
getResponseEventTypeLocations,
getResponseEventTypeBookingFields,
getResponseEventTypeIntervalLimits,
getResponseEventTypeFutureBookingLimits,
getResponseEventTypeRecurrence,
};
@@ -1,9 +1,11 @@
export enum Frequency {
YEARLY = 0,
MONTHLY = 1,
WEEKLY = 2,
DAILY = 3,
HOURLY = 4,
MINUTELY = 5,
SECONDLY = 6,
yearly = 0,
monthly = 1,
weekly = 2,
}
export enum FrequencyInput {
yearly = "yearly",
monthly = "monthly",
weekly = "weekly",
}
+5
View File
@@ -1,3 +1,8 @@
## 0.0.30
• Feature: Added support for recurringEvent in api/v2/event-types.
• Introduced the transformApiEventTypeRecurrence translator in packages/lib/event-types/transformers/api-request.ts. This enables the “recurringEvent” feature in the event-type API.
• Added getResponseEventTypeRecurrence translator in packages/lib/event-types/transformers/api-response.ts to return data in a more human-friendly format.
## 0.0.28
• Feature: Added support for new event-type limits in the API.
• Introduced the transformApiEventTypeFutureBookingLimits translator in packages/lib/event-types/transformers/api-request.ts. This enables the “Limit future bookings” feature in the event-type API.
+2
View File
@@ -102,6 +102,8 @@ export {
getResponseEventTypeIntervalLimits,
getResponseEventTypeFutureBookingLimits,
transformApiEventTypeFutureBookingLimits,
transformApiEventTypeRecurrence,
getResponseEventTypeRecurrence,
} from "@calcom/lib/event-types/transformers";
export { parseBookingLimit } from "@calcom/lib";
@@ -24,6 +24,7 @@ import type { BookingWindow_2024_06_14 } from "./booking-window.input";
import { ValidateBookingWindow } from "./booking-window.input";
import { ValidateLocations_2024_06_14 } from "./locations.input";
import type { Location_2024_06_14 } from "./locations.input";
import { Recurrence_2024_06_14 } from "./recurrence.input";
export const CREATE_EVENT_LENGTH_EXAMPLE = 60;
export const CREATE_EVENT_TITLE_EXAMPLE = "Learn the secrets of masterchief!";
@@ -103,6 +104,11 @@ export class CreateEventTypeInput_2024_06_14 {
@IsInt()
@Min(1)
offsetStart?: number;
@IsOptional()
@ValidateNested()
@Type(() => Recurrence_2024_06_14)
recurrence?: Recurrence_2024_06_14;
}
export enum HostPriority {
@@ -4,6 +4,6 @@ export * from "./booking-limits-count.input";
export * from "./booking-window.input";
export * from "./locations.input";
export * from "./booking-fields.input";
export * from "./recurring-event.input";
export * from "./recurrence.input";
export * from "./update-event-type.input";
export * from "./get-event-types-query.input";
@@ -0,0 +1,24 @@
import { ApiProperty } from "@nestjs/swagger";
import { IsInt, IsEnum } from "class-validator";
import { FrequencyInput } from "@calcom/platform-enums";
export type TransformRecurringEventSchema_2024_06_14 = {
interval: number;
count: number;
freq: number;
};
export class Recurrence_2024_06_14 {
@IsInt()
@ApiProperty({ example: 10, description: "Repeats every {count} week | month | year" })
interval!: number;
@IsInt()
@ApiProperty({ example: 10, description: "Repeats for a maximum of {count} events" })
occurrences!: number;
@IsEnum(FrequencyInput)
@ApiProperty({ enum: FrequencyInput })
frequency!: FrequencyInput;
}
@@ -1,34 +0,0 @@
import { IsInt, IsEnum, IsOptional, IsString, IsDateString } from "class-validator";
export enum Frequency {
YEARLY = 0,
MONTHLY = 1,
WEEKLY = 2,
DAILY = 3,
HOURLY = 4,
MINUTELY = 5,
SECONDLY = 6,
}
export class RecurringEvent_2024_06_14 {
@IsOptional()
@IsDateString()
dtstart?: Date;
@IsInt()
interval!: number;
@IsInt()
count!: number;
@IsEnum(Frequency)
freq!: Frequency;
@IsOptional()
@IsDateString()
until?: Date;
@IsOptional()
@IsString()
tzid?: string;
}
@@ -13,6 +13,7 @@ import { ValidateBookingWindow, type BookingWindow_2024_06_14 } from "./booking-
import { Host } from "./create-event-type.input";
import { ValidateLocations_2024_06_14 } from "./locations.input";
import type { Location_2024_06_14 } from "./locations.input";
import { Recurrence_2024_06_14 } from "./recurrence.input";
export class UpdateEventTypeInput_2024_06_14 {
@IsOptional()
@@ -87,6 +88,11 @@ export class UpdateEventTypeInput_2024_06_14 {
@IsInt()
@Min(1)
offsetStart?: number;
@IsOptional()
@ValidateNested()
@Type(() => Recurrence_2024_06_14)
recurrence?: Recurrence_2024_06_14;
}
export class UpdateTeamEventTypeInput_2024_06_14 {
@IsOptional()
@@ -180,4 +186,9 @@ export class UpdateTeamEventTypeInput_2024_06_14 {
@IsInt()
@Min(1)
offsetStart?: number;
@IsOptional()
@ValidateNested()
@Type(() => Recurrence_2024_06_14)
recurrence?: Recurrence_2024_06_14;
}
@@ -13,7 +13,7 @@ import {
import type { Location_2024_06_14, BookingField_2024_06_14, BookingWindow_2024_06_14 } from "../inputs";
import { Host as TeamEventTypeHostInput, BookingLimitsDuration_2024_06_14 } from "../inputs";
import { RecurringEvent_2024_06_14 } from "../inputs";
import { Recurrence_2024_06_14 } from "../inputs";
import { ValidateBookingFields_2024_06_14 } from "../inputs/booking-fields.input";
import type { BookingLimitsCount_2024_06_14 } from "../inputs/booking-limits-count.input";
import { ValidateLocations_2024_06_14 } from "../inputs/locations.input";
@@ -101,8 +101,8 @@ export class EventTypeOutput_2024_06_14 {
@IsEnum(SchedulingTypeEnum)
schedulingType!: EventTypesOutputSchedulingType | null;
@Type(() => RecurringEvent_2024_06_14)
recurringEvent!: RecurringEvent_2024_06_14 | null;
@Type(() => Recurrence_2024_06_14)
recurrence!: Recurrence_2024_06_14 | null;
@Type(() => Object)
metadata!: Record<string, unknown>;
@@ -211,8 +211,8 @@ export class TeamEventTypeOutput_2024_06_14 {
@IsEnum(SchedulingTypeEnum)
schedulingType!: EventTypesOutputSchedulingType | null;
@Type(() => RecurringEvent_2024_06_14)
recurringEvent!: RecurringEvent_2024_06_14 | null;
@Type(() => Recurrence_2024_06_14)
recurrence!: Recurrence_2024_06_14 | null;
@Type(() => Object)
metadata!: Record<string, unknown>;
+105 -14
View File
@@ -3507,7 +3507,8 @@ __metadata:
resolution: "@calcom/api-v2@workspace:apps/api/v2"
dependencies:
"@calcom/platform-constants": "*"
"@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.28"
"@calcom/platform-enums": "*"
"@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.30"
"@calcom/platform-libraries-0.0.2": "npm:@calcom/platform-libraries@0.0.2"
"@calcom/platform-types": "*"
"@calcom/platform-utils": "*"
@@ -3695,6 +3696,7 @@ __metadata:
vite: ^5.0.10
vite-plugin-dts: ^3.7.3
vite-plugin-inspect: ^0.8.4
vite-plugin-node-polyfills: ^0.22.0
languageName: unknown
linkType: soft
@@ -4433,6 +4435,14 @@ __metadata:
languageName: unknown
linkType: soft
"@calcom/platform-enums@*, @calcom/platform-enums@workspace:packages/platform/enums":
version: 0.0.0-use.local
resolution: "@calcom/platform-enums@workspace:packages/platform/enums"
dependencies:
"@calcom/platform-constants": "*"
languageName: unknown
linkType: soft
"@calcom/platform-libraries-0.0.2@npm:@calcom/platform-libraries@0.0.2, @calcom/platform-libraries@npm:0.0.2":
version: 0.0.2
resolution: "@calcom/platform-libraries@npm:0.0.2"
@@ -4444,14 +4454,14 @@ __metadata:
languageName: node
linkType: hard
"@calcom/platform-libraries@npm:@calcom/platform-libraries@0.0.28":
version: 0.0.28
resolution: "@calcom/platform-libraries@npm:0.0.28"
"@calcom/platform-libraries@npm:@calcom/platform-libraries@0.0.30":
version: 0.0.30
resolution: "@calcom/platform-libraries@npm:0.0.30"
dependencies:
"@calcom/core": "*"
"@calcom/features": "*"
"@calcom/lib": "*"
checksum: b75480471eee9c60fd14d847b033e6ef9fe6b261a10aff5787db7db649802ca8aeac2f85660f970638956eb312268508a10b349a8a017b2dde9aa9221a6b5118
checksum: 85af636aa21187a28c53c5cd7e5b1ff6b88410d905f53ee3d6cc2e6a3ef4d0b8a80fac77bc290bbe3d093edea53f015d47db5e7e791f462622c0d642bfd09722
languageName: node
linkType: hard
@@ -4476,6 +4486,7 @@ __metadata:
resolution: "@calcom/platform-types@workspace:packages/platform/types"
dependencies:
"@calcom/platform-constants": "*"
"@calcom/platform-enums": "*"
"@types/express": ^4.17.21
class-validator: ^0.14.0
languageName: unknown
@@ -4928,6 +4939,7 @@ __metadata:
"@calcom/embed-snippet": "workspace:*"
"@calcom/features": "*"
"@calcom/lib": "*"
"@calcom/platform-enums": "*"
"@calcom/platform-types": "*"
"@calcom/prisma": "*"
"@calcom/trpc": "*"
@@ -11653,6 +11665,22 @@ __metadata:
languageName: node
linkType: hard
"@rollup/plugin-inject@npm:^5.0.5":
version: 5.0.5
resolution: "@rollup/plugin-inject@npm:5.0.5"
dependencies:
"@rollup/pluginutils": ^5.0.1
estree-walker: ^2.0.2
magic-string: ^0.30.3
peerDependencies:
rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
peerDependenciesMeta:
rollup:
optional: true
checksum: 22cb772fd6f7178308b2ece95cdde5f8615f6257197832166294552a7e4c0d3976dc996cbfa6470af3151d8b86c00091aa93da5f4db6ec563f11b6db29fd1b63
languageName: node
linkType: hard
"@rollup/plugin-json@npm:^6.1.0":
version: 6.1.0
resolution: "@rollup/plugin-json@npm:6.1.0"
@@ -18621,6 +18649,15 @@ __metadata:
languageName: node
linkType: hard
"browser-resolve@npm:^2.0.0":
version: 2.0.0
resolution: "browser-resolve@npm:2.0.0"
dependencies:
resolve: ^1.17.0
checksum: 69225e73b555bd6d2a08fb93c7342cfcf3b5058b975099c52649cd5c3cec84c2066c5385084d190faedfb849684d9dabe10129f0cd401d1883572f2e6650f440
languageName: node
linkType: hard
"browserify-aes@npm:^1.0.0, browserify-aes@npm:^1.0.4":
version: 1.2.0
resolution: "browserify-aes@npm:1.2.0"
@@ -18860,7 +18897,7 @@ __metadata:
languageName: node
linkType: hard
"buffer@npm:^5.2.0, buffer@npm:^5.5.0":
"buffer@npm:^5.2.0, buffer@npm:^5.5.0, buffer@npm:^5.7.1":
version: 5.7.1
resolution: "buffer@npm:5.7.1"
dependencies:
@@ -20328,7 +20365,7 @@ __metadata:
languageName: node
linkType: hard
"console-browserify@npm:^1.2.0":
"console-browserify@npm:^1.1.0, console-browserify@npm:^1.2.0":
version: 1.2.0
resolution: "console-browserify@npm:1.2.0"
checksum: 226591eeff8ed68e451dffb924c1fb750c654d54b9059b3b261d360f369d1f8f70650adecf2c7136656236a4bfeb55c39281b5d8a55d792ebbb99efd3d848d52
@@ -20706,7 +20743,7 @@ __metadata:
languageName: node
linkType: hard
"create-require@npm:^1.1.0":
"create-require@npm:^1.1.0, create-require@npm:^1.1.1":
version: 1.1.1
resolution: "create-require@npm:1.1.1"
checksum: a9a1503d4390d8b59ad86f4607de7870b39cad43d929813599a23714831e81c520bddf61bcdd1f8e30f05fd3a2b71ae8538e946eb2786dc65c2bbc520f692eff
@@ -28122,6 +28159,13 @@ __metadata:
languageName: node
linkType: hard
"isomorphic-timers-promises@npm:^1.0.1":
version: 1.0.1
resolution: "isomorphic-timers-promises@npm:1.0.1"
checksum: 16ef59f0fbcceba1a037c74b5f7195d252ae058724ccd3e53b37ad034e8498f5532084e8ab18e7940ba3fa8fca2f21403d00eed15802ab1f7cab7c099cba62a8
languageName: node
linkType: hard
"isstream@npm:~0.1.2":
version: 0.1.2
resolution: "isstream@npm:0.1.2"
@@ -32395,6 +32439,41 @@ __metadata:
languageName: node
linkType: hard
"node-stdlib-browser@npm:^1.2.0":
version: 1.2.0
resolution: "node-stdlib-browser@npm:1.2.0"
dependencies:
assert: ^2.0.0
browser-resolve: ^2.0.0
browserify-zlib: ^0.2.0
buffer: ^5.7.1
console-browserify: ^1.1.0
constants-browserify: ^1.0.0
create-require: ^1.1.1
crypto-browserify: ^3.11.0
domain-browser: ^4.22.0
events: ^3.0.0
https-browserify: ^1.0.0
isomorphic-timers-promises: ^1.0.1
os-browserify: ^0.3.0
path-browserify: ^1.0.1
pkg-dir: ^5.0.0
process: ^0.11.10
punycode: ^1.4.1
querystring-es3: ^0.2.1
readable-stream: ^3.6.0
stream-browserify: ^3.0.0
stream-http: ^3.2.0
string_decoder: ^1.0.0
timers-browserify: ^2.0.4
tty-browserify: 0.0.1
url: ^0.11.0
util: ^0.12.4
vm-browserify: ^1.0.1
checksum: fe491f0839319fd9bb95964c6f7da81fc7fde4c3ac9062aa367f19bc5a6060d0d9e423d3de4196cb51f8259d6aaf6cf380048c48a86eb3721c6223dd0dcc5bfd
languageName: node
linkType: hard
"nodemailer@npm:^6.7.8":
version: 6.7.8
resolution: "nodemailer@npm:6.7.8"
@@ -37140,7 +37219,7 @@ __metadata:
languageName: node
linkType: hard
"resolve@npm:1.22.8, resolve@npm:^1.1.6, resolve@npm:^1.22.2, resolve@npm:^1.22.4, resolve@npm:~1.22.1":
"resolve@npm:1.22.8, resolve@npm:^1.1.6, resolve@npm:^1.17.0, resolve@npm:^1.22.2, resolve@npm:^1.22.4, resolve@npm:~1.22.1":
version: 1.22.8
resolution: "resolve@npm:1.22.8"
dependencies:
@@ -37238,7 +37317,7 @@ __metadata:
languageName: node
linkType: hard
"resolve@patch:resolve@1.22.8#~builtin<compat/resolve>, resolve@patch:resolve@^1.1.6#~builtin<compat/resolve>, resolve@patch:resolve@^1.22.2#~builtin<compat/resolve>, resolve@patch:resolve@^1.22.4#~builtin<compat/resolve>, resolve@patch:resolve@~1.22.1#~builtin<compat/resolve>":
"resolve@patch:resolve@1.22.8#~builtin<compat/resolve>, resolve@patch:resolve@^1.1.6#~builtin<compat/resolve>, resolve@patch:resolve@^1.17.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.22.2#~builtin<compat/resolve>, resolve@patch:resolve@^1.22.4#~builtin<compat/resolve>, resolve@patch:resolve@~1.22.1#~builtin<compat/resolve>":
version: 1.22.8
resolution: "resolve@patch:resolve@npm%3A1.22.8#~builtin<compat/resolve>::version=1.22.8&hash=c3c19d"
dependencies:
@@ -39295,7 +39374,7 @@ __metadata:
languageName: node
linkType: hard
"string_decoder@npm:^1.1.1, string_decoder@npm:^1.3.0":
"string_decoder@npm:^1.0.0, string_decoder@npm:^1.1.1, string_decoder@npm:^1.3.0":
version: 1.3.0
resolution: "string_decoder@npm:1.3.0"
dependencies:
@@ -40299,7 +40378,7 @@ __metadata:
languageName: node
linkType: hard
"timers-browserify@npm:^2.0.12":
"timers-browserify@npm:^2.0.12, timers-browserify@npm:^2.0.4":
version: 2.0.12
resolution: "timers-browserify@npm:2.0.12"
dependencies:
@@ -40927,7 +41006,7 @@ __metadata:
languageName: node
linkType: hard
"tty-browserify@npm:^0.0.1":
"tty-browserify@npm:0.0.1, tty-browserify@npm:^0.0.1":
version: 0.0.1
resolution: "tty-browserify@npm:0.0.1"
checksum: 93b745d43fa5a7d2b948fa23be8d313576d1d884b48acd957c07710bac1c0d8ac34c0556ad4c57c73d36e11741763ef66b3fb4fb97b06b7e4d525315a3cd45f5
@@ -42174,6 +42253,18 @@ __metadata:
languageName: node
linkType: hard
"vite-plugin-node-polyfills@npm:^0.22.0":
version: 0.22.0
resolution: "vite-plugin-node-polyfills@npm:0.22.0"
dependencies:
"@rollup/plugin-inject": ^5.0.5
node-stdlib-browser: ^1.2.0
peerDependencies:
vite: ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0
checksum: c08d3df0d5cc3102280483d3f7b216f92a18e0708fcb9f67f78f01ab865474254756bacee17caa90b3f46afe5834cb9d8de0dd0e58c1bbbdae1b949edc1e6b57
languageName: node
linkType: hard
"vite@npm:^3.0.0 || ^4.0.0 || ^5.0.0-0, vite@npm:^3.1.0 || ^4.0.0 || ^5.0.0-0, vite@npm:^5.0.10, vite@npm:^5.0.12":
version: 5.1.6
resolution: "vite@npm:5.1.6"
@@ -42377,7 +42468,7 @@ __metadata:
languageName: node
linkType: hard
"vm-browserify@npm:^1.1.2":
"vm-browserify@npm:^1.0.1, vm-browserify@npm:^1.1.2":
version: 1.1.2
resolution: "vm-browserify@npm:1.1.2"
checksum: 10a1c50aab54ff8b4c9042c15fc64aefccce8d2fb90c0640403242db0ee7fb269f9b102bdb69cfb435d7ef3180d61fd4fb004a043a12709abaf9056cfd7e039d