feat: extend api/v2/event-types (#16128)

* feat: extended api/v2/event-types to add more attributes

- additional attributes added
* bookingLimits
* onlyShowFirstAvailableSlot
* durationLimits
* offsetStart
* bookingWindow

* add swagger docs

* type fix

* extend api/v2/teams/[teamId]/event-types

* added tests

* extend api/v2/orgs/[orgId]/teams/[teamid]/event-types

* update: added tests to get and update event-type as well

* rename variables

- bookingLimits -> bookingLimitsCount
- durationLimits -> bookingLimitsDuration

* refactor: rename bookingLimits and durationLimits, add descriptions

- Renamed `bookingLimits` to `bookingLimitsCount`
- Renamed `durationLimits` to `bookingLimitsDuration`
- Added descriptions with examples to `bookingLimitsCount` and `bookingLimitsDuration`

* feat: add unit tests for transformation logic in api-request and api-response

- Added tests for `transformApiEventTypeIntervalLimits`
- Added tests for `transformApiEventTypeFutureBookingLimits`

* fix: type errors

* feat: added custom validators for BookingLimitsCount and BookingLimitsDuration

* fix: unit-tests

* Update CHANGELOG.md

* refactor: update imports to use platform-libraries from @calcom/platform-libraries-1.2.3

* fix: prevent double transformation of bookingWindow and bookingFields

- resolving e2e test failures

---------

Co-authored-by: Morgan <[email protected]>
This commit is contained in:
Somay ChauhanandMorgan authored and GitHub committed 2024-08-16 09:25:34 +00:00
1 parent 894c0fc8a7
commit 8fbc76d59a
28 files changed
+1261 -5956

No files matched your search

+74 -34
View File
@@ -6631,33 +6631,6 @@
"type": "string",
"example": "Discover the culinary wonders of the Argentina by making the best flan ever!"
},
"locations": {
"type": "array",
"items": {
"type": "string"
}
},
"bookingFields": {
"type": "array",
"items": {
"type": "string"
}
},
"disableGuests": {
"type": "boolean"
},
"slotInterval": {
"type": "number"
},
"minimumBookingNotice": {
"type": "number"
},
"beforeEventBuffer": {
"type": "number"
},
"afterEventBuffer": {
"type": "number"
},
"schedulingType": {
"type": "object"
},
@@ -6675,13 +6648,6 @@
"lengthInMinutes",
"title",
"description",
"locations",
"bookingFields",
"disableGuests",
"slotInterval",
"minimumBookingNotice",
"beforeEventBuffer",
"afterEventBuffer",
"schedulingType",
"hosts",
"assignAllTeamMembers"
@@ -6779,6 +6745,64 @@
"userId"
]
},
"BookingLimitsCount_2024_06_14": {
"type": "object",
"properties": {
"day": {
"type": "number",
"minimum": 1,
"description": "The number of bookings per day",
"example": 1
},
"week": {
"type": "number",
"minimum": 1,
"description": "The number of bookings per week",
"example": 2
},
"month": {
"type": "number",
"minimum": 1,
"description": "The number of bookings per month",
"example": 3
},
"year": {
"type": "number",
"minimum": 1,
"description": "The number of bookings per year",
"example": 4
}
}
},
"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
}
}
},
"TeamEventTypeOutput_2024_06_14": {
"type": "object",
"properties": {
@@ -6898,6 +6922,22 @@
},
"assignAllTeamMembers": {
"type": "boolean"
},
"bookingLimitsCount": {
"$ref": "#/components/schemas/BookingLimitsCount_2024_06_14"
},
"onlyShowFirstAvailableSlot": {
"type": "boolean"
},
"bookingLimitsDuration": {
"$ref": "#/components/schemas/BookingLimitsDuration_2024_06_14"
},
"bookingWindow": {
"type": "object"
},
"offsetStart": {
"type": "number",
"minimum": 1
}
},
"required": [