-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Open
Labels
PrivateCreated by Linear-GitHub SyncCreated by Linear-GitHub Syncapiarea: API, enterprise API, access token, OAutharea: API, enterprise API, access token, OAuthplatformAnything related to our platform planAnything related to our platform plan💻 refactor
Description
Problem
If a patch request is sent to https://cal.com/docs/api-reference/v2/event-types/update-an-event-type with bookingFields
e.g.
{
"bookingFields": [
{
"type": "email",
"disableOnPrefill": true
}
]
}
then it will overwrite all existing booking fields. That means that if a user wants to modify existing booking field or add a new one he / she needs to fetch all existing event type booking fields, put them in the request "bookingFields". Or to delete a booking field once again need to fetch all existing and remove one that is not needed anymore.
Solution
- For modifying and creating new booking fields. In
apps/api/v2/src/ee/event-types/event-types_2024_06_14/services/input-event-types.service.ts
modify functiontransformInputUpdateEventType
logic forbookingFields
. Need to accesseventTypeDb.bookingFields
(existing booking fields in database) and then check:- If the passed booking field in the request does not exist, add the missing booking field to the
Metadata
Metadata
Assignees
Labels
PrivateCreated by Linear-GitHub SyncCreated by Linear-GitHub Syncapiarea: API, enterprise API, access token, OAutharea: API, enterprise API, access token, OAuthplatformAnything related to our platform planAnything related to our platform plan💻 refactor