feat: add advanced tab attributes to api/v2/event-types (#16314)

* added bookerLayouts

* added requiresConfirmation

* added tests

* undo extra changes

* undo extra change

* fixed imports

* added requiresBookerEmailVerification

* added hideCalendarNotes

* added lockTimeZoneToggleOnBookingPage

* added eventTypeColor

* undo extra changes

* added seats

* added requiresConfirmationWillBlockSlot to requiresConfirmation

* refactor: Implement BaseEventType class to avoid duplication across EventType input/output classes

## D-R-Y ##

* temp-fix: will revert later

* Correct placement of users array from EventTypeOutput to TeamEventTypeOutput

* Refactor: Shifted transformation logic to controllers using interceptors and pipes for a cleaner service layer.

* small fix

* Refactor: Moved transformation logic from service to controller using interceptors and pipes

** organisations/event-types

* feat: adde tests for `validateEventTypeInputs`

* fix: failing test

* fix: layout validator

* renamed blockCalendarForUnconfirmedBookings to blockUnconfirmedBookingsInBooker

* testing changes

* added disabled state

* fix merege conflict

* renamed requiresConfirmation to confirmationPolicy

* renamed OutputEventTypesResponseInterceptor to OutputTeamEventTypesResponseInterceptor

* renamed `darkThemeColor` -> `darkThemeHex` and `lightThemeColor` -> `lightThemeHex`

* renamed `eventTypeColor` -> `color`

* changed `requiresConfirmation` -> `confirmationPolicy`

* added tests for disabled state

* added class-validators to `disabled?: false`

* Revert: Split create and update input/output classes

* feat: Refactor responses to use DTOs with plainToClass for explicit property control

	•	Updated all endpoints to return response DTOs (e.g., CreateTeamEventTypeOutput, GetTeamEventTypeOutput) to ensure consistent Swagger documentation generation.
	•	Introduced plainToClass for transforming responses, enabling explicit control over which properties are returned in the response, following Morgan’s recommendation.
	•	Replaced generic HandlerResponse type with class-validator based DTOs for each endpoint, ensuring TypeScript enforces correct response structure.
	•	Applied strategy: "excludeAll" to limit response properties to only those explicitly defined in the DTO, preventing unintended fields from being included in the API responses.

* added pipes to transform output data

* add clean script to platform-types package.json

* added customName

* added destination calendar

* fixed type errors

* added useDestinationCalendarEmail

* refactor: api-reqest and api-response

* Update event-type.output.ts

* fixed errors

* Update yarn.lock

* added some missed properties to output

* Update constants.ts

* removed return type

* fixed some type errors

* reuse types

* Improve readability of validation functions

* Update CHANGELOG.md

* chore: post publish platform libraries

* Update documentation.json

* fix: reset platform libraries to 0.0.0

* fixup! fix: reset platform libraries to 0.0.0

* Update event-type.tranformed.ts

---------

Co-authored-by: supalarry <[email protected]>
Co-authored-by: Morgan Vernay <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-09-24 13:36:05 +03:00
1 parent 6de454b071
commit 2e2a6c73b1
68 files changed
+2859 -6305

No files matched your search

+263 -195
View File
@@ -4923,6 +4923,11 @@
"nullable": true,
"example": "alice"
},
"name": {
"type": "string",
"nullable": true,
"example": "alice"
},
"timeZone": {
"type": "string",
"example": "America/New_York"
@@ -4998,6 +5003,7 @@
"id",
"email",
"username",
"name",
"timeZone",
"weekStart",
"createdDate",
@@ -6079,94 +6085,6 @@
"value"
]
},
"BookingLimitsCount_2024_06_14": {
"type": "object",
"properties": {
"day": {
"type": "number",
"description": "The number of bookings per day",
"example": 1
},
"week": {
"type": "number",
"description": "The number of bookings per week",
"example": 2
},
"month": {
"type": "number",
"description": "The number of bookings per month",
"example": 3
},
"year": {
"type": "number",
"description": "The number of bookings per year",
"example": 4
}
},
"required": [
"day",
"week",
"month",
"year"
]
},
"BookingLimitsDuration_2024_06_14": {
"type": "object",
"properties": {
"day": {
"type": "number",
"minimum": 15,
"description": "The duration of bookings per day (must be a multiple of 15)",
"example": 60
},
"week": {
"type": "number",
"minimum": 15,
"description": "The duration of bookings per week (must be a multiple of 15)",
"example": 120
},
"month": {
"type": "number",
"minimum": 15,
"description": "The duration of bookings per month (must be a multiple of 15)",
"example": 180
},
"year": {
"type": "number",
"minimum": 15,
"description": "The duration of bookings per year (must be a multiple of 15)",
"example": 240
}
}
},
"Recurrence_2024_06_14": {
"type": "object",
"properties": {
"interval": {
"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": {
"type": "string",
"enum": [
"yearly",
"monthly",
"weekly"
]
}
},
"required": [
"interval",
"occurrences",
"frequency"
]
},
"CreateEventTypeInput_2024_06_14": {
"type": "object",
"properties": {
@@ -6272,24 +6190,16 @@
"description": "If you want that this event has different schedule than user's default one you can specify it here."
},
"bookingLimitsCount": {
"description": "Limit how many times this event can be booked",
"allOf": [
{
"$ref": "#/components/schemas/BookingLimitsCount_2024_06_14"
}
]
"type": "object",
"description": "Limit how many times this event can be booked"
},
"onlyShowFirstAvailableSlot": {
"type": "boolean",
"description": "This will limit your availability for this event type to one slot per day, scheduled at the earliest available time."
},
"bookingLimitsDuration": {
"description": "Limit total amount of time that this event can be booked",
"allOf": [
{
"$ref": "#/components/schemas/BookingLimitsDuration_2024_06_14"
}
]
"type": "object",
"description": "Limit total amount of time that this event can be booked"
},
"bookingWindow": {
"type": "array",
@@ -6312,13 +6222,10 @@
"type": "number",
"description": "Offset timeslots shown to bookers by a specified number of minutes"
},
"recurrence": {
"description": "Create a recurring event that can be booked once but will occur multiple times",
"allOf": [
{
"$ref": "#/components/schemas/Recurrence_2024_06_14"
}
]
"customName": {
"type": "string",
"description": "Customizable event name with valid variables: \n {Event type title}, {Organiser}, {Scheduler}, {Location}, {Organiser first name}, \n {Scheduler first name}, {Scheduler last name}, {Event duration}, {LOCATION}, \n {HOST/ATTENDEE}, {HOST}, {ATTENDEE}, {USER}",
"example": "{Event type title} between {Organiser} and {Scheduler}"
}
},
"required": [
@@ -6339,7 +6246,7 @@
"bookingLimitsDuration",
"bookingWindow",
"offsetStart",
"recurrence"
"customName"
]
},
"EmailDefaultFieldOutput_2024_06_14": {
@@ -7136,6 +7043,104 @@
"isDefault"
]
},
"BaseBookingLimitsDuration_2024_06_14": {
"type": "object",
"properties": {
"day": {
"type": "number",
"minimum": 15,
"description": "The duration of bookings per day (must be a multiple of 15)",
"example": 60
},
"week": {
"type": "number",
"minimum": 15,
"description": "The duration of bookings per week (must be a multiple of 15)",
"example": 120
},
"month": {
"type": "number",
"minimum": 15,
"description": "The duration of bookings per month (must be a multiple of 15)",
"example": 180
},
"year": {
"type": "number",
"minimum": 15,
"description": "The duration of bookings per year (must be a multiple of 15)",
"example": 240
},
"disabled": {
"type": "boolean",
"default": false
}
}
},
"BookerLayouts_2024_06_14": {
"type": "object",
"properties": {}
},
"EventTypeColor_2024_06_14": {
"type": "object",
"properties": {
"lightThemeHex": {
"type": "string",
"description": "Color used for event types in light theme",
"example": "#292929"
},
"darkThemeHex": {
"type": "string",
"description": "Color used for event types in dark theme",
"example": "#fafafa"
}
},
"required": [
"lightThemeHex",
"darkThemeHex"
]
},
"Seats_2024_06_14": {
"type": "object",
"properties": {
"seatsPerTimeSlot": {
"type": "number",
"description": "Number of seats available per time slot",
"example": 4
},
"showAttendeeInfo": {
"type": "boolean",
"description": "Show attendee information to other guests",
"example": true
},
"showAvailabilityCount": {
"type": "boolean",
"description": "Display the count of available seats",
"example": true
}
},
"required": [
"seatsPerTimeSlot",
"showAttendeeInfo",
"showAvailabilityCount"
]
},
"DestinationCalendar_2024_06_14": {
"type": "object",
"properties": {
"integration": {
"type": "string",
"description": "The integration type of the destination calendar. Refer to the /api/v2/calendars endpoint to retrieve the integration type of your connected calendars."
},
"externalId": {
"type": "string",
"description": "The external ID of the destination calendar. Refer to the /api/v2/calendars endpoint to retrieve the external IDs of your connected calendars."
}
},
"required": [
"integration",
"externalId"
]
},
"EventTypeOutput_2024_06_14": {
"type": "object",
"properties": {
@@ -7157,7 +7162,7 @@
},
"description": {
"type": "string",
"example": "Discover the culinary wonders of the Argentina by making the best flan ever!"
"example": "Discover the culinary wonders of Argentina by making the best flan ever!"
},
"locations": {
"type": "array",
@@ -7264,9 +7269,6 @@
"metadata": {
"type": "object"
},
"requiresConfirmation": {
"type": "boolean"
},
"price": {
"type": "number"
},
@@ -7285,6 +7287,9 @@
"successRedirectUrl": {
"type": "object"
},
"isInstantEvent": {
"type": "boolean"
},
"seatsShowAvailabilityCount": {
"type": "object"
},
@@ -7292,13 +7297,13 @@
"type": "object"
},
"bookingLimitsCount": {
"$ref": "#/components/schemas/BookingLimitsCount_2024_06_14"
"type": "object"
},
"onlyShowFirstAvailableSlot": {
"type": "boolean"
},
"bookingLimitsDuration": {
"$ref": "#/components/schemas/BookingLimitsDuration_2024_06_14"
"type": "object"
},
"bookingWindow": {
"type": "array",
@@ -7317,9 +7322,36 @@
]
}
},
"bookerLayouts": {
"$ref": "#/components/schemas/BookerLayouts_2024_06_14"
},
"confirmationPolicy": {
"type": "object"
},
"requiresBookerEmailVerification": {
"type": "boolean"
},
"hideCalendarNotes": {
"type": "boolean"
},
"color": {
"$ref": "#/components/schemas/EventTypeColor_2024_06_14"
},
"seats": {
"$ref": "#/components/schemas/Seats_2024_06_14"
},
"offsetStart": {
"type": "number"
},
"customName": {
"type": "string"
},
"destinationCalendar": {
"$ref": "#/components/schemas/DestinationCalendar_2024_06_14"
},
"useDestinationCalendarEmail": {
"type": "boolean"
},
"ownerId": {
"type": "number",
"example": 10
@@ -7346,20 +7378,29 @@
"afterEventBuffer",
"recurrence",
"metadata",
"requiresConfirmation",
"price",
"currency",
"lockTimeZoneToggleOnBookingPage",
"seatsPerTimeSlot",
"forwardParamsSuccessRedirect",
"successRedirectUrl",
"isInstantEvent",
"seatsShowAvailabilityCount",
"scheduleId",
"bookingLimitsCount",
"onlyShowFirstAvailableSlot",
"bookingLimitsDuration",
"bookingWindow",
"bookerLayouts",
"confirmationPolicy",
"requiresBookerEmailVerification",
"hideCalendarNotes",
"color",
"seats",
"offsetStart",
"customName",
"destinationCalendar",
"useDestinationCalendarEmail",
"ownerId",
"users"
]
@@ -7537,24 +7578,16 @@
"description": "If you want that this event has different schedule than user's default one you can specify it here."
},
"bookingLimitsCount": {
"description": "Limit how many times this event can be booked",
"allOf": [
{
"$ref": "#/components/schemas/BookingLimitsCount_2024_06_14"
}
]
"type": "object",
"description": "Limit how many times this event can be booked"
},
"onlyShowFirstAvailableSlot": {
"type": "boolean",
"description": "This will limit your availability for this event type to one slot per day, scheduled at the earliest available time."
},
"bookingLimitsDuration": {
"description": "Limit total amount of time that this event can be booked",
"allOf": [
{
"$ref": "#/components/schemas/BookingLimitsDuration_2024_06_14"
}
]
"type": "object",
"description": "Limit total amount of time that this event can be booked"
},
"bookingWindow": {
"type": "array",
@@ -7577,13 +7610,10 @@
"type": "number",
"description": "Offset timeslots shown to bookers by a specified number of minutes"
},
"recurrence": {
"description": "Create a recurring event that can be booked once but will occur multiple times",
"allOf": [
{
"$ref": "#/components/schemas/Recurrence_2024_06_14"
}
]
"customName": {
"type": "string",
"description": "Customizable event name with valid variables: \n {Event type title}, {Organiser}, {Scheduler}, {Location}, {Organiser first name}, \n {Scheduler first name}, {Scheduler last name}, {Event duration}, {LOCATION}, \n {HOST/ATTENDEE}, {HOST}, {ATTENDEE}, {USER}",
"example": "{Event type title} between {Organiser} and {Scheduler}"
}
},
"required": [
@@ -7604,7 +7634,7 @@
"bookingLimitsDuration",
"bookingWindow",
"offsetStart",
"recurrence"
"customName"
]
},
"UpdateEventTypeOutput_2024_06_14": {
@@ -7938,6 +7968,9 @@
"weekStart": {
"type": "string",
"default": "Sunday"
},
"bookingLimits": {
"type": "string"
}
}
},
@@ -8930,24 +8963,16 @@
"description": "If you want that this event has different schedule than user's default one you can specify it here."
},
"bookingLimitsCount": {
"description": "Limit how many times this event can be booked",
"allOf": [
{
"$ref": "#/components/schemas/BookingLimitsCount_2024_06_14"
}
]
"type": "object",
"description": "Limit how many times this event can be booked"
},
"onlyShowFirstAvailableSlot": {
"type": "boolean",
"description": "This will limit your availability for this event type to one slot per day, scheduled at the earliest available time."
},
"bookingLimitsDuration": {
"description": "Limit total amount of time that this event can be booked",
"allOf": [
{
"$ref": "#/components/schemas/BookingLimitsDuration_2024_06_14"
}
]
"type": "object",
"description": "Limit total amount of time that this event can be booked"
},
"bookingWindow": {
"type": "array",
@@ -8970,13 +8995,10 @@
"type": "number",
"description": "Offset timeslots shown to bookers by a specified number of minutes"
},
"recurrence": {
"description": "Create a recurring event that can be booked once but will occur multiple times",
"allOf": [
{
"$ref": "#/components/schemas/Recurrence_2024_06_14"
}
]
"customName": {
"type": "string",
"description": "Customizable event name with valid variables: \n {Event type title}, {Organiser}, {Scheduler}, {Location}, {Organiser first name}, \n {Scheduler first name}, {Scheduler last name}, {Event duration}, {LOCATION}, \n {HOST/ATTENDEE}, {HOST}, {ATTENDEE}, {USER}",
"example": "{Event type title} between {Organiser} and {Scheduler}"
},
"schedulingType": {
"type": "object"
@@ -9010,7 +9032,7 @@
"bookingLimitsDuration",
"bookingWindow",
"offsetStart",
"recurrence",
"customName",
"schedulingType",
"hosts",
"assignAllTeamMembers"
@@ -9046,6 +9068,38 @@
"data"
]
},
"Recurrence_2024_06_14": {
"type": "object",
"properties": {
"interval": {
"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": [
"yearly",
"monthly",
"weekly"
],
"type": "string"
},
"disabled": {
"type": "boolean",
"default": false
}
},
"required": [
"interval",
"occurrences",
"frequency"
]
},
"TeamEventTypeResponseHost": {
"type": "object",
"properties": {
@@ -9101,7 +9155,7 @@
},
"description": {
"type": "string",
"example": "Discover the culinary wonders of the Argentina by making the best flan ever!"
"example": "Discover the culinary wonders of Argentina by making the best flan ever!"
},
"locations": {
"type": "array",
@@ -9215,9 +9269,6 @@
"metadata": {
"type": "object"
},
"requiresConfirmation": {
"type": "boolean"
},
"price": {
"type": "number"
},
@@ -9239,6 +9290,9 @@
"type": "string",
"nullable": true
},
"isInstantEvent": {
"type": "boolean"
},
"seatsShowAvailabilityCount": {
"type": "boolean",
"nullable": true
@@ -9248,13 +9302,13 @@
"nullable": true
},
"bookingLimitsCount": {
"$ref": "#/components/schemas/BookingLimitsCount_2024_06_14"
"type": "object"
},
"onlyShowFirstAvailableSlot": {
"type": "boolean"
},
"bookingLimitsDuration": {
"$ref": "#/components/schemas/BookingLimitsDuration_2024_06_14"
"type": "object"
},
"bookingWindow": {
"type": "array",
@@ -9273,18 +9327,36 @@
]
}
},
"bookerLayouts": {
"$ref": "#/components/schemas/BookerLayouts_2024_06_14"
},
"confirmationPolicy": {
"type": "object"
},
"requiresBookerEmailVerification": {
"type": "boolean"
},
"hideCalendarNotes": {
"type": "boolean"
},
"color": {
"$ref": "#/components/schemas/EventTypeColor_2024_06_14"
},
"seats": {
"$ref": "#/components/schemas/Seats_2024_06_14"
},
"offsetStart": {
"type": "number",
"minimum": 1
},
"schedulingType": {
"type": "string",
"nullable": true,
"enum": [
"ROUND_ROBIN",
"COLLECTIVE",
"MANAGED"
]
"customName": {
"type": "string"
},
"destinationCalendar": {
"$ref": "#/components/schemas/DestinationCalendar_2024_06_14"
},
"useDestinationCalendarEmail": {
"type": "boolean"
},
"teamId": {
"type": "number",
@@ -9297,7 +9369,7 @@
"parentEventTypeId": {
"type": "number",
"nullable": true,
"description": "For managed event types parent event type is the event type that this event type is based on"
"description": "For managed event types, parent event type is the event type that this event type is based on"
},
"hosts": {
"type": "array",
@@ -9307,6 +9379,15 @@
},
"assignAllTeamMembers": {
"type": "boolean"
},
"schedulingType": {
"type": "string",
"nullable": true,
"enum": [
"ROUND_ROBIN",
"COLLECTIVE",
"MANAGED"
]
}
},
"required": [
@@ -9320,17 +9401,15 @@
"disableGuests",
"recurrence",
"metadata",
"requiresConfirmation",
"price",
"currency",
"lockTimeZoneToggleOnBookingPage",
"seatsPerTimeSlot",
"forwardParamsSuccessRedirect",
"successRedirectUrl",
"seatsShowAvailabilityCount",
"isInstantEvent",
"scheduleId",
"schedulingType",
"hosts"
"hosts",
"schedulingType"
]
},
"GetTeamEventTypeOutput": {
@@ -9580,24 +9659,16 @@
"description": "If you want that this event has different schedule than user's default one you can specify it here."
},
"bookingLimitsCount": {
"description": "Limit how many times this event can be booked",
"allOf": [
{
"$ref": "#/components/schemas/BookingLimitsCount_2024_06_14"
}
]
"type": "object",
"description": "Limit how many times this event can be booked"
},
"onlyShowFirstAvailableSlot": {
"type": "boolean",
"description": "This will limit your availability for this event type to one slot per day, scheduled at the earliest available time."
},
"bookingLimitsDuration": {
"description": "Limit total amount of time that this event can be booked",
"allOf": [
{
"$ref": "#/components/schemas/BookingLimitsDuration_2024_06_14"
}
]
"type": "object",
"description": "Limit total amount of time that this event can be booked"
},
"bookingWindow": {
"type": "array",
@@ -9620,13 +9691,10 @@
"type": "number",
"description": "Offset timeslots shown to bookers by a specified number of minutes"
},
"recurrence": {
"description": "Create a recurring event that can be booked once but will occur multiple times",
"allOf": [
{
"$ref": "#/components/schemas/Recurrence_2024_06_14"
}
]
"customName": {
"type": "string",
"description": "Customizable event name with valid variables: \n {Event type title}, {Organiser}, {Scheduler}, {Location}, {Organiser first name}, \n {Scheduler first name}, {Scheduler last name}, {Event duration}, {LOCATION}, \n {HOST/ATTENDEE}, {HOST}, {ATTENDEE}, {USER}",
"example": "{Event type title} between {Organiser} and {Scheduler}"
},
"hosts": {
"type": "array",
@@ -9657,7 +9725,7 @@
"bookingLimitsDuration",
"bookingWindow",
"offsetStart",
"recurrence",
"customName",
"hosts",
"assignAllTeamMembers"
]