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

+7 -1
View File
@@ -1,3 +1,10 @@
## 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.
• Introduced the transformApiEventTypeIntervalLimits translator in packages/lib/event-types/transformers/api-request.ts. This allows the “Limit total booking duration” and “Limit booking frequency” features in the event-type API.
• Added getResponseEventTypeIntervalLimits translator in packages/lib/event-types/transformers/api-response.ts to return data in a more human-friendly format.
• Added getResponseEventTypeFutureBookingLimits translator in packages/lib/event-types/transformers/api-response.ts to improve the clarity and readability of the response data.
## 0.0.26
Update `packages/app-store/office365calendar/lib/CalendarService.ts` "translateEvent" content so that in microsoft outlook calendar event the description
has newlines instead of being all in 1 line.
@@ -6,7 +13,6 @@ has newlines instead of being all in 1 line.
Refactor "packages/lib/event-types/transformers/api-request.ts" getResponseEventTypeBookingFields - make sure that booking fields with options don't have
undefines options.
## 0.0.24
Refactor "packages/lib/event-types/transformers/api-request.ts" - we access event-type booking fields in database and then distinguish them as either
created by the user or system. Then in v2 api "event-types_2024_06_14/services/output-event-types.service.ts" we first parse them and then filter
+5
View File
@@ -93,13 +93,18 @@ export { EventTypeMetaDataSchema, userMetadata } from "@calcom/prisma/zod-utils"
export {
transformApiEventTypeBookingFields,
transformApiEventTypeIntervalLimits,
transformApiEventTypeLocations,
getResponseEventTypeLocations,
getResponseEventTypeBookingFields,
TransformedLocationsSchema,
BookingFieldsSchema,
getResponseEventTypeIntervalLimits,
getResponseEventTypeFutureBookingLimits,
transformApiEventTypeFutureBookingLimits,
} from "@calcom/lib/event-types/transformers";
export { parseBookingLimit } from "@calcom/lib";
export type { SystemField, UserField } from "@calcom/lib/event-types/transformers";
export { parseRecurringEvent } from "@calcom/lib/isRecurringEvent";