Skip to content

Comments

fix: v2 api event type splitName booking field#24111

Merged
supalarry merged 2 commits intomainfrom
lauris/cal-6472-fix-v2-event-type-split-name
Sep 29, 2025
Merged

fix: v2 api event type splitName booking field#24111
supalarry merged 2 commits intomainfrom
lauris/cal-6472-fix-v2-event-type-split-name

Conversation

@supalarry
Copy link
Contributor

@supalarry supalarry commented Sep 26, 2025

Linear CAL-6472

Problem

When creating an event type with split name field there is an error

{
    "status": "error",
    "timestamp": "2025-09-25T07:30:51.426Z",
    "path": "/v2/organizations/93/teams/93/event-types",
    "error": {
        "code": "BadRequestException",
        "message": "Validation failed for splitName booking field: type must be one of the following values: name, email, phone, address, text, number, textarea, select, multiselect, multiemail, checkbox, radio, boolean, url",
        "details": {
            "message": "Validation failed for splitName booking field: type must be one of the following values: name, email, phone, address, text, number, textarea, select, multiselect, multiemail, checkbox, radio, boolean, url",
            "error": "Bad Request",
            "statusCode": 400
        }
    }
}

Solution

Add splitName within booking-fields.input.ts - it was missing withininputBookingFieldTypes

Add a test creating event type with split name field event-types.controller.e2e-spec.ts

@supalarry supalarry requested a review from a team September 26, 2025 14:21
@supalarry supalarry requested review from a team as code owners September 26, 2025 14:21
@linear
Copy link

linear bot commented Sep 26, 2025

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 26, 2025

Walkthrough

Updated event-types tests and types to support a new booking field type "splitName". The e2e spec imports SplitNameDefaultFieldOutput_2024_06_14, adds tests that create an event type with a splitName booking field (and cleans up the created fixture), and asserts updatedEventType.hidden === false in a patched flow. Teardown catch blocks now log errors. The allowed input booking field types list (inputBookingFieldTypes) was extended to include "splitName".

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly summarizes the main change by indicating that the v2 API event type now supports the splitName booking field, matching the primary fix implemented in this pull request in a concise and specific manner.
Linked Issues Check ✅ Passed This pull request fully implements the objectives of CAL-6472 by adding “splitName” to the inputBookingFieldTypes constant and including an E2E test to verify creating an event type with the splitName field, satisfying the linked issue requirements.
Out of Scope Changes Check ✅ Passed All modifications are limited to updating booking-fields.input.ts and the event-types controller e2e spec to support the new splitName field and cleanup test fixtures, with no unrelated or extraneous changes introduced.
Description Check ✅ Passed The description directly addresses the validation error for the splitName booking field and explains the solution of updating the allowed input types and adding an end-to-end test, making it clearly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch lauris/cal-6472-fix-v2-event-type-split-name

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6da1946 and 04cd4a0.

📒 Files selected for processing (1)
  • apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.ts (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@graphite-app graphite-app bot requested a review from a team September 26, 2025 14:22
@keithwillcode keithwillcode added core area: core, team members only platform Anything related to our platform plan labels Sep 26, 2025
@dosubot dosubot bot added the 🐛 bug Something isn't working label Sep 26, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.ts (2)

1451-1451: Use console.error for teardown errors

Prefer console.error for errors to improve signal in CI logs.

-        console.log(e);
+        console.error(e);

Also applies to: 1456-1456, 1461-1461, 1467-1467


2239-2239: Use console.error for teardown errors

Same here for consistency.

-        console.log(e);
+        console.error(e);

Also applies to: 2244-2244, 2434-2434, 2440-2440

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d261a23 and 6da1946.

📒 Files selected for processing (2)
  • apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.ts (5 hunks)
  • packages/platform/types/event-types/event-types_2024_06_14/inputs/booking-fields.input.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/platform/types/event-types/event-types_2024_06_14/inputs/booking-fields.input.ts
  • apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/platform/types/event-types/event-types_2024_06_14/inputs/booking-fields.input.ts
  • apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.ts
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • packages/platform/types/event-types/event-types_2024_06_14/inputs/booking-fields.input.ts
  • apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: supalarry
PR: calcom/cal.com#23364
File: apps/api/v2/src/ee/event-types/event-types_2024_06_14/transformers/internal-to-api/internal-to-api.spec.ts:295-296
Timestamp: 2025-08-27T13:32:46.887Z
Learning: In calcom/cal.com, when transforming booking fields from internal to API format, tests in organizations-event-types.e2e-spec.ts already expect name field label and placeholder to be empty strings ("") rather than undefined. PR changes that set these to explicit empty strings are typically fixing implementation to match existing test expectations rather than breaking changes.
Learnt from: supalarry
PR: calcom/cal.com#23217
File: apps/api/v2/src/ee/event-types/event-types_2024_06_14/services/output-event-types.service.ts:93-94
Timestamp: 2025-08-21T13:44:06.805Z
Learning: In apps/api/v2/src/ee/event-types/event-types_2024_06_14/event-types.repository.ts, repository functions that use explicit Prisma select clauses (like getEventTypeWithSeats) are used for specific purposes and don't need to include all EventType fields like bookingRequiresAuthentication. These methods don't feed into the general OutputEventTypesService_2024_06_14 flow.
📚 Learning: 2025-08-27T13:32:46.887Z
Learnt from: supalarry
PR: calcom/cal.com#23364
File: apps/api/v2/src/ee/event-types/event-types_2024_06_14/transformers/internal-to-api/internal-to-api.spec.ts:295-296
Timestamp: 2025-08-27T13:32:46.887Z
Learning: In calcom/cal.com, when transforming booking fields from internal to API format, tests in organizations-event-types.e2e-spec.ts already expect name field label and placeholder to be empty strings ("") rather than undefined. PR changes that set these to explicit empty strings are typically fixing implementation to match existing test expectations rather than breaking changes.

Applied to files:

  • packages/platform/types/event-types/event-types_2024_06_14/inputs/booking-fields.input.ts
  • apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.ts
📚 Learning: 2025-08-21T13:44:06.805Z
Learnt from: supalarry
PR: calcom/cal.com#23217
File: apps/api/v2/src/ee/event-types/event-types_2024_06_14/services/output-event-types.service.ts:93-94
Timestamp: 2025-08-21T13:44:06.805Z
Learning: In apps/api/v2/src/ee/event-types/event-types_2024_06_14/event-types.repository.ts, repository functions that use explicit Prisma select clauses (like getEventTypeWithSeats) are used for specific purposes and don't need to include all EventType fields like bookingRequiresAuthentication. These methods don't feed into the general OutputEventTypesService_2024_06_14 flow.

Applied to files:

  • apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.ts
🧬 Code graph analysis (1)
apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.ts (4)
packages/platform/types/event-types/event-types_2024_06_14/outputs/booking-fields.output.ts (1)
  • SplitNameDefaultFieldOutput_2024_06_14 (56-76)
packages/platform/types/event-types/event-types_2024_06_14/inputs/create-event-type.input.ts (1)
  • CreateEventTypeInput_2024_06_14 (485-504)
packages/platform/types/api.ts (1)
  • ApiSuccessResponse (8-8)
packages/platform/types/event-types/event-types_2024_06_14/outputs/event-type.output.ts (1)
  • EventTypeOutput_2024_06_14 (475-484)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Check for E2E label
🔇 Additional comments (3)
packages/platform/types/event-types/event-types_2024_06_14/inputs/booking-fields.input.ts (1)

8-11: Add splitName to allowed input types — LGTM

This unblocks validation for splitName and aligns with classMap + fieldNeedsSlug logic.

apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.ts (2)

41-42: Public type import for SplitName — LGTM

Type is used in the new e2e test.


2424-2424: Assert hidden=false after patch — LGTM

Covers the hidden toggle behavior.

@vercel
Copy link

vercel bot commented Sep 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Sep 26, 2025 2:41pm
cal-eu Ignored Ignored Sep 26, 2025 2:41pm

@github-actions
Copy link
Contributor

E2E results are ready!

@supalarry supalarry merged commit 1458cac into main Sep 29, 2025
60 of 61 checks passed
@supalarry supalarry deleted the lauris/cal-6472-fix-v2-event-type-split-name branch September 29, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working core area: core, team members only platform Anything related to our platform plan ready-for-e2e size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants