Skip to content

refactor: updating v2 event type booking fields #22596

@linear

Description

@linear

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

  1. 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 function transformInputUpdateEventType logic for bookingFields. Need to access eventTypeDb.bookingFields (existing booking fields in database) and then check:
    1. If the passed booking field in the request does not exist, add the missing booking field to the

Metadata

Metadata

Assignees

No one assigned

    Labels

    PrivateCreated by Linear-GitHub Syncapiarea: API, enterprise API, access token, OAuthplatformAnything related to our platform plan💻 refactor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions