fix(api-v2): align openapi contract with prisma schema for destinatio…#29536
fix(api-v2): align openapi contract with prisma schema for destinatio…#29536GAURAV07C wants to merge 3 commits into
Conversation
…n calendars and bookings
|
Welcome to Cal.diy, @GAURAV07C! Thanks for opening this pull request. A few things to keep in mind:
A maintainer will review your PR soon. Thanks for contributing! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR re-exports app-store symbols from packages/platform/libraries, updates imports to use the new public entry point, replaces BookingReference's eventUid/destinationCalendarId with uid in DTOs/services/docs, removes CalVideoSettings.sendTranscriptionEmails from types and service mapping, marks several DestinationCalendar fields as optional with matching Swagger decorators, updates controller ApiParam descriptions to reference bookingReference.uid, and removes INSTANT_MEETING from webhook trigger enums in the OpenAPI spec. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/api/v2/src/platform/calendars/outputs/connected-calendars.output.ts (1)
209-211:⚠️ Potential issue | 🟡 MinorAlign
DestinationCalendar.idDTO type with Prisma and caching.
apps/api/v2/src/platform/calendars/outputs/connected-calendars.output.tsdeclaresid!: number | stringwith@IsInt(), butDestinationCalendar’s Prisma model usesid Int, andgetConnectedDestinationCalendarsAndEnsureDefaultsInDbpopulatesdestinationCalendardirectly from Prisma create/update results; the API also caches the whole object in Redis usingJSON.stringify/parse, which preserves numbers. Sinceidshould be numeric, the| stringunion is misleading (and would break if response validation runs). Change the DTO toid!: number.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/api/v2/src/platform/calendars/outputs/connected-calendars.output.ts` around lines 209 - 211, Change the DestinationCalendar DTO property to a numeric-only id: remove the union type and declare id as number (i.e., change id!: number | string to id!: number) so it matches the Prisma model (id Int), the Redis JSON cached objects, and the `@IsInt`() validation; update the declaration in connected-calendars.output.ts for the DestinationCalendar/connected calendar output class (the id property) and ensure any related usages (e.g., getConnectedDestinationCalendarsAndEnsureDefaultsInDb consumers) expect a number.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/api-reference/v2/openapi.json`:
- Around line 1964-1968: Update the OpenAPI description for the path parameter
"eventUid" to explicitly state that callers must populate this calendar eventId
from the booking reference object's "uid" field returned by GET
/v2/bookings/{bookingUid}/references (the response no longer contains
"eventUid"); apply the same wording change to all other "eventUid" parameter
descriptions in the spec so they reference booking reference "uid" instead of
"eventUid".
---
Outside diff comments:
In `@apps/api/v2/src/platform/calendars/outputs/connected-calendars.output.ts`:
- Around line 209-211: Change the DestinationCalendar DTO property to a
numeric-only id: remove the union type and declare id as number (i.e., change
id!: number | string to id!: number) so it matches the Prisma model (id Int),
the Redis JSON cached objects, and the `@IsInt`() validation; update the
declaration in connected-calendars.output.ts for the
DestinationCalendar/connected calendar output class (the id property) and ensure
any related usages (e.g., getConnectedDestinationCalendarsAndEnsureDefaultsInDb
consumers) expect a number.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e8f509b4-9ac1-4ff4-a83b-38349a03b315
📒 Files selected for processing (8)
apps/api/v2/src/filters/calendar-service-exception.filter.tsapps/api/v2/src/platform/bookings/2024-08-13/outputs/booking-references.output.tsapps/api/v2/src/platform/bookings/2024-08-13/services/output-booking-references.service.tsapps/api/v2/src/platform/calendars/outputs/connected-calendars.output.tsapps/api/v2/src/platform/event-types/event-types_2024_06_14/services/input-event-types.service.tsdocs/api-reference/v2/openapi.jsonpackages/platform/libraries/index.tspackages/platform/types/event-types/event-types_2024_06_14/inputs/create-event-type.input.ts
💤 Files with no reviewable changes (1)
- packages/platform/types/event-types/event-types_2024_06_14/inputs/create-event-type.input.ts
Description
Fixes #29531
This PR resolves strict contract mismatches in the API v2 OpenAPI specification (
openapi.json) by aligning the NestJS DTOs with the underlying Prisma schema.✨ Key Fixes:
eventUid→uiddestinationCalendarId(not present in Prisma schema and not reliably populated at runtime).sendTranscriptionEmailsfrom the DTO as it does not exist in the Prisma schema and was incorrectly exposed in the API contract.🛠 Infrastructure / Build Fix (unrelated to schema drift):
MODULE_NOT_FOUNDerror blockingyarn generate-swaggerexecution in API v2 by explicitly re-exportingapp-storeproperties from@calcom/platform-libraries/index.ts.Type of change
How Has This Been Tested?
docs/api-reference/v2/openapi.jsonwithpackages/prisma/schema.prismato verify drift resolution.yarn testinapps/api/v2to verify no existing internal tests break due to destructive field removals (all 275 tests passed).yarn generate-swaggercompletes without build/import errors.Checklist:
yarn type-check:ci --forcepasses)yarn biome check --write .to lint and format the changes