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 <[email protected]>
This commit is contained in:
Somay ChauhanandMorgan Vernay authored and GitHub committed 2024-08-26 11:42:35 +03:00
1 parent 03051a2bb1
commit ef11755488
25 files changed
+512 -102

No files matched your search

@@ -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>;