- Replace PrismaClientKnownRequestError and other error classes with Prisma namespace equivalents
- Remove internal DefaultArgs and InternalArgs type imports from Prisma extensions
- Ensure all error handling uses stable public API exports
- Maintain compatibility with future Prisma versions by avoiding runtime dependencies
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
* refactor: lucky user to service class with DI
* fix: unit test filterHostsByLeadThreshold.test.ts
* fixup! fix: unit test filterHostsByLeadThreshold.test.ts
* fix: get lucky user test missing mocks
* fix: get lucky user hosts not within interval
* chore: bump platform library
* chore: bump platform library
* chore: add DAILY_API_KEY to turborepo.json db seed
* chore: add DAILY_API_KEY to cache-db action
* fixup! chore: add DAILY_API_KEY to cache-db action
* chore: remove log in fixture
* chore: bump platform library
* chore: refactor test team-emails.e2e
* only failing test
* run all api v2 tests
* chore: bump platform library
* revert change to turbo.json and action in cache-db
* chore: use inPerson location in team-emails.e2e
2025-08-26 08:43:41 -03:00
Alex van AndelGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* feat: extract tRPC verification logic to platform libraries and create v2 atoms endpoints
- Extract verifyCodeUnAuthenticated, verifyCodeAuthenticated, and sendVerifyEmailCode logic from tRPC handlers into reusable platform library functions
- Create VerificationAtomsService and AtomsVerificationController following atoms pattern
- Add v2 endpoints: /atoms/verification/email/send-code, /atoms/verification/email/verify-code, /atoms/verification/email/verify-code-authenticated
- Update useVerifyEmail and useVerifyCode hooks to use new v2 endpoints instead of verified-resources endpoints
- Export verification functions from @calcom/platform-libraries following getPublicEvent pattern
- Integrate platform-specific verification hooks into BookerPlatformWrapper
Co-Authored-By: somay@cal.com <somaychauhan98@gmail.com>
* feat: update platform hooks to use v2 verification endpoints
- Update useVerifyEmail hook to use correct response type for v2 endpoint
- Update useVerifyCode hook to use v2 verification endpoint
- All verification functions now properly exported from platform libraries
- Type checking passes with no errors
Co-Authored-By: somay@cal.com <somaychauhan98@gmail.com>
* fix: update v2 API to use workspace version of platform-libraries
- Change package.json dependency from pinned version to workspace version
- Add proper error handling to verification service with NestJS HTTP exceptions
- Convert generic Error objects to BadRequestException and UnauthorizedException
- Ensure verification endpoints return proper HTTP status codes instead of 500 errors
Co-Authored-By: somay@cal.com <somaychauhan98@gmail.com>
* chore: update auto-generated files after package.json changes
- Update OpenAPI documentation for v2 verification endpoints
- Update yarn.lock after changing platform-libraries dependency
Co-Authored-By: somay@cal.com <somaychauhan98@gmail.com>
* refactor: extract verification logic from tRPC handlers into exportable functions
- Refactor sendVerifyEmailCode.handler.ts to extract core logic into sendVerifyEmailCode function
- Refactor verifyCodeUnAuthenticated.handler.ts to extract core logic into verifyCodeUnAuthenticated function
- Refactor organizations/verifyCode.handler.ts to extract core logic into verifyCodeAuthenticated function
- Update platform/libraries/index.ts to import from refactored handler files instead of standalone verification.ts
- Remove standalone verification.ts file as requested by user
- Keep original tRPC handlers as wrappers that call the extracted functions
- Maintain backward compatibility for existing tRPC endpoints
Co-Authored-By: somay@cal.com <somaychauhan98@gmail.com>
* extract logic into seperate functions
* Update index.ts
* refactor: remove unused type imports from verification-atom service
* feat: create v2 atoms input/output types for verification endpoints
- Add SendVerificationEmailInput and VerifyEmailCodeInput with validation decorators
- Add SendVerificationEmailOutput and VerifyEmailCodeOutput following v2 atoms patterns
- Update atoms verification controller to use custom types instead of platform types
- Auto-update openapi.json with new type definitions
Co-Authored-By: somay@cal.com <somaychauhan98@gmail.com>
* fix: add missing type imports to verification service
- Import ZVerifyCodeInputSchema from @calcom/prisma/zod-utils
- Import VerifyCodeAuthenticatedInput from organizations handler
- Import TSendVerifyEmailCodeSchema from sendVerifyEmailCode schema
- Resolves CI build failure in API v2 tests
Co-Authored-By: somay@cal.com <somaychauhan98@gmail.com>
* feat: add email verification check endpoint and refactor verification flow
* added Throttle
* added chagelog
* chore: update platform libraries to 0.0.317
* refactor: remove unused context and update email verification query key dependencies
* chore: bump @calcom/platform-libraries from 0.0.318 to 0.0.319
* Update verifyCode.handler.ts
* chore: bump @calcom/platform-libraries from 0.0.319 to 0.0.320
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* upgrade turborepo from 1 to 2.5
* Fix tsconfig.json paths path
* chore: fix root path on tsconfig.paths
* chore: add baseUrl to tsconfig.json
* chore: tsconfig.json issue
* try: CI without tsconfig paths
* chore: add only local paths on tsconfig.json
* chore: Fix docs
* Fix missing env var on turbo.json
* Fix membership deletion handling and add tests
* fixes
* revert api-v2 specific changes
* Add more tests
* refactor: Move removeMember function into TeamService as private static methods
- Moved removeMember and all related helper functions from separate file into TeamService class
- Made all functions private static methods instead of exporting them
- Deleted the original removeMember.ts file since it's no longer needed
- Updated imports to use the new location
- All integration tests pass successfully
* refactor: Rename memberId to userId in TeamService methods
- Renamed memberId parameter to userId in removeMember private method
- Renamed memberIds parameter to userIds in removeMembers public method
- Updated all calls to removeMembers to use userIds instead of memberIds
- Parameter names now accurately reflect that they are user IDs, not membership IDs
* test: add service unit tests and simplify e2e tests for membership deletion
- Add unit tests for membership deletion services
- Remove redundant deletion behavior tests from controllers
- Keep only happy path tests in e2e controller tests
- Fix unused imports and variables
* package.json version
* fix unit teswtes
* No specs file
* fix unit tests
* fix: Add platform-libraries build step to E2E API v2 workflow
The E2E API v2 tests were failing with TypeScript compilation errors because
TeamService imports from @calcom/platform-libraries require the package to be
built first to generate the dist/ folder with compiled exports.
This adds the same build step that was added to unit-tests.yml to resolve
the module resolution errors.
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* Making tests clearer and easier to undestand
* chore: bump platform libs
* chore: bump platform libs
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
Co-authored-by: cal.com <morgan@cal.com>
* refactor: convert handleNotificationWhenNoSlots to service class with DI
- Convert standalone handleNotificationWhenNoSlots function to NoSlotsNotificationService class
- Add INoSlotsNotificationService interface following existing patterns
- Create NoSlotsNotification DI module and add to container
- Add NO_SLOTS_NOTIFICATION_SERVICE tokens to DI_TOKENS
- Inject service into AvailableSlotsService dependencies
- Update AvailableSlotsService to use injected service instead of direct function call
- Update all test cases to use service class pattern
- Follows existing DI patterns used by other services like BusyTimesService and CheckBookingLimitsService
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* refactor: move Prisma calls to repositories and create dedicated DI container
- Add findOrganizationSettingsBySlug and findTeamSlugById methods to TeamRepository
- Add findTeamAdminsByTeamId method to MembershipRepository
- Create MembershipRepository DI module and tokens
- Update NoSlotsNotificationService to inject TeamRepository, MembershipRepository, and Redis client
- Create dedicated DI container for NoSlotsNotificationService
- Update AvailableSlots DI container to include MembershipRepository
- Replace direct Prisma and Redis calls with repository methods and injected client
- Update tests to use DI container instead of direct service instantiation
- Fix Redis interface import path
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* chore: DI noSlotsNotification service
* chore: bump library
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: morgan@cal.com <morgan@cal.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
* fix: gracefully handle calendar failures when bypassBusyCalendarTimes is enabled
- When _bypassCalendarBusyTimes parameter is true and third-party calendar fetching fails
- System now falls back to internal bookings only instead of throwing error
- Maintains existing error behavior when bypass is disabled
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* feat: add _silentCalendarFailures parameter to handle calendar failures gracefully
- Add silentlyHandleCalendarFailures parameter to getBusyTimes service
- Add _silentCalendarFailures parameter to getUserAvailability schema
- Add _silentCalendarFailures parameter to tRPC slots endpoint
- Add _silentCalendarFailures parameter to API v2 slots/available endpoint
- Parameter attempts calendar calls first, falls back silently on failure
- Different from bypassCalendarBusyTimes which skips calendar calls entirely
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* refactor: remove bypassBusyCalendarTimes logic from error handling
- Keep only silentlyHandleCalendarFailures logic in getBusyTimes error handling
- Remove redundant bypassBusyCalendarTimes condition from calendar failure handling
- Maintain existing bypassBusyCalendarTimes logic that skips calendar calls entirely
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* feat: add silentlyHandleCalendarFailures prop to Booker atom
- Pass silentlyHandleCalendarFailures prop from BookerPlatformWrapper to useAvailableSlots
- Forward prop as _silentCalendarFailures parameter to API v2 slots/available endpoint
- Complete the parameter flow from Booker atom to underlying service layer
- Enables silent handling of calendar provider failures in Booker component
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* chore: fix type and bump library
* chore: bump library
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: morgan@cal.com <morgan@cal.com>
Co-authored-by: Somay Chauhan <somaychauhan98@gmail.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
* feat: add PATCH endpoint for updating Google Calendar events
- Create UpdateUnifiedCalendarEventInput DTO with optional fields for partial updates
- Add PATCH /:calendar/event/:eventUid endpoint to CalUnifiedCalendarsController
- Extend GoogleCalendarService with updateEventDetails method
- Support updating title, description, start/end times for Google Calendar events
- Follow existing patterns for validation, error handling, and response transformation
- Initially support Google Calendar only with extensibility for other providers
Co-Authored-By: somay@cal.com <somay@cal.com>
* feat: expand PATCH endpoint to support all calendar event fields
- Add comprehensive field support to UpdateUnifiedCalendarEventInput DTO
- Include locations, attendees, status, and hosts fields with proper validation
- Expand GoogleCalendarService.updateEventDetails to handle complex field transformations
- Add helper methods for response status and event status mapping
- Preserve existing transformation logic from GoogleCalendarEventOutputPipe
- Support conferenceData updates with conferenceDataVersion parameter
Co-Authored-By: somay@cal.com <somay@cal.com>
* fix: add support for simple location field in Google Calendar events
- Add handling for geographic location field in addition to conferenceData
- Filter non-video locations for the simple location string field
- Preserve existing conferenceData support for video meetings
- Verified against Google Calendar API documentation
Co-Authored-By: somay@cal.com <somay@cal.com>
* refactor: extract transformation logic into GoogleCalendarEventInputPipe
- Create GoogleCalendarEventInputPipe following existing patterns
- Extract transformation logic from updateEventDetails method
- Move mapping methods to the new pipe for better organization
- Improve code reusability and maintainability
Addresses PR comment requesting transformation logic extraction.
Co-Authored-By: somay@cal.com <somay@cal.com>
* refactor: remove locations field and simplify calendar event input handling
* update docs
* refactor: remove hosts field from the update endpoint
* fix: exclude organizer from attendees list in Google Calendar event transformation
* feat: implement organizer preservation logic in PATCH endpoint
- Fetch existing Google Calendar event data before transformation
- Extract organizer attendees from existing event and merge with user-provided attendees
- Prevent accidental removal of organizers when users update attendees
- Add custom interface for GoogleCalendarEventInputPipe to support optional existingEvent parameter
- Preserve organizers unless user explicitly provides hosts field in update request
Co-Authored-By: somay@cal.com <somay@cal.com>
* feat: add hosts array handling to PATCH endpoint
- Add hosts field back to UpdateUnifiedCalendarEventInput DTO
- Implement transformAttendeesWithHostsHandling method in GoogleCalendarEventInputPipe
- Convert hosts to attendees with organizer: true for Google Calendar API
- When hosts are provided, they replace existing organizers (not merge)
- Maintain backward compatibility with existing organizer preservation logic
Co-Authored-By: somay@cal.com <somay@cal.com>
* feat: implement sophisticated attendee update logic with preservation and deletion support
- Add UpdateCalendarEventAttendee class with action: 'delete' support
- Implement attendee preservation logic that starts with existing Google Calendar attendees
- Support explicit attendee deletion using action: 'delete' field
- Update existing attendees when provided without action field
- Add new attendees that don't exist in current event
- Preserve organizer status when updating existing attendees
- Fetch existing event data when attendees OR hosts are being updated
- Maintain hosts array handling that replaces existing organizers
Co-Authored-By: somay@cal.com <somay@cal.com>
* feat: add host management and attendee deletion to calendar event API
* refactor: improve readability of transformAttendeesWithHostsHandling and restrict hosts to responseStatus updates only
- Break down complex transformAttendeesWithHostsHandling method into smaller, more readable helper functions:
- preserveExistingAttendees: handles existing attendee preservation
- processAttendeeDeletions: handles attendee deletion logic
- processAttendeeUpdatesAndAdditions: handles attendee updates and additions
- replaceHostsWithUpdatedOnes: handles host replacement with restrictions
- Create UpdateCalendarEventHost class that only allows responseStatus updates
- Restrict hosts array to prevent changes to name, email, and other fields
- Preserve existing host displayName from Google Calendar when updating responseStatus
Co-Authored-By: somay@cal.com <somay@cal.com>
* feat: restrict host updates to responseStatus only, preserve email and name from Google Calendar data
- Remove email field from UpdateCalendarEventHost class
- Update replaceHostsWithUpdatedOnes to preserve all host data except responseStatus
- Apply responseStatus updates to all existing organizers from Google Calendar
- Prevent users from updating host email or name fields
Co-Authored-By: somay@cal.com <somay@cal.com>
* Revert "feat: restrict host updates to responseStatus only, preserve email and name from Google Calendar data"
This reverts commit 22d07ce0cb13e71661522b2fd8a237d8b6e0809c.
* refactor: replace optional flag with organizer property in calendar event attendees
* refactor: remove organizer field from calendar event attendee input
* feat: add comprehensive test suites for calendar transformation pipes
- Create google-calendar-event-input.pipe.spec.ts with 67 test cases
- Create get-calendar-event-details-output-pipe.spec.ts with 35 test cases
- Follow event-types transformer test patterns with separate describe blocks
- Cover all transformation functions including edge cases and null handling
- Test attendee preservation, deletion, host management, and status transformations
- Ensure comprehensive coverage for sophisticated attendee update logic
Co-Authored-By: somay@cal.com <somay@cal.com>
* fix: remove invalid optional properties from calendar pipe tests
- Remove optional: false from line 85 in 'should transform attendees without existing event' test case
- Remove optional: true from line 388 in 'should update existing attendee' test case
- Remove optional: false from line 421 in 'should add new attendee' test case
- Update expected outputs to match actual pipe implementation behavior
- All 30 tests now pass locally
Co-Authored-By: somay@cal.com <somay@cal.com>
* fix: add platform library path mappings to Jest configuration
- Resolves module resolution errors for @calcom/platform-libraries/* imports in Jest
- Ensures test suite can run without 'Cannot find module' errors
- Adds comprehensive path mappings matching TypeScript configuration
Co-Authored-By: somay@cal.com <somay@cal.com>
* fix: add @calcom/dayjs path mapping to Jest configuration
- Add missing moduleNameMapper entry for @calcom/dayjs to resolve TypeScript path mappings in Jest
- Fixes TypeError: Cannot read properties of undefined (reading 'extend') in calendar pipe tests
- Calendar transformation pipe tests now pass successfully
Co-Authored-By: somay@cal.com <somay@cal.com>
* fix: configure Jest to use dayjs mock system for consistent test environment
- Remove @calcom/dayjs path mapping from Jest config
- Add setupFilesAfterEnv to automatically import dayjs mock
- Update dayjs mock with comprehensive jest.fn() implementation
- Add @calcom/platform-libraries/repositories and @calcom/prisma/client mappings
- Resolves dayjs TypeError in slots.service.spec.ts and other test files
Co-Authored-By: somay@cal.com <somay@cal.com>
* fix: complete shared Google event data with required properties for test suites
- Add missing required properties to sharedGoogleEvent in both test files
- Fix TypeScript compilation errors in calendar transformation pipe tests
- Correct test assertion for attendees filtering logic in output pipe
- All 11 test suites now pass with 199 tests total
Co-Authored-By: somay@cal.com <somay@cal.com>
* undo extra changes
* better tests
* fix: update calendar API endpoints to use plural events in path
* update documentation
* fix: Restrict updates to only the responseStatus field for hosts
* feat: add PATCH endpoint for updating Google Calendar events
- Create UpdateUnifiedCalendarEventInput DTO with optional fields for partial updates
- Add PATCH /:calendar/event/:eventUid endpoint to CalUnifiedCalendarsController
- Extend GoogleCalendarService with updateEventDetails method
- Support updating title, description, start/end times for Google Calendar events
- Follow existing patterns for validation, error handling, and response transformation
- Initially support Google Calendar only with extensibility for other providers
Co-Authored-By: somay@cal.com <somay@cal.com>
* feat: expand PATCH endpoint to support all calendar event fields
- Add comprehensive field support to UpdateUnifiedCalendarEventInput DTO
- Include locations, attendees, status, and hosts fields with proper validation
- Expand GoogleCalendarService.updateEventDetails to handle complex field transformations
- Add helper methods for response status and event status mapping
- Preserve existing transformation logic from GoogleCalendarEventOutputPipe
- Support conferenceData updates with conferenceDataVersion parameter
Co-Authored-By: somay@cal.com <somay@cal.com>
* fix: add support for simple location field in Google Calendar events
- Add handling for geographic location field in addition to conferenceData
- Filter non-video locations for the simple location string field
- Preserve existing conferenceData support for video meetings
- Verified against Google Calendar API documentation
Co-Authored-By: somay@cal.com <somay@cal.com>
* refactor: extract transformation logic into GoogleCalendarEventInputPipe
- Create GoogleCalendarEventInputPipe following existing patterns
- Extract transformation logic from updateEventDetails method
- Move mapping methods to the new pipe for better organization
- Improve code reusability and maintainability
Addresses PR comment requesting transformation logic extraction.
Co-Authored-By: somay@cal.com <somay@cal.com>
* refactor: remove locations field and simplify calendar event input handling
* update docs
* refactor: remove hosts field from the update endpoint
* fix: exclude organizer from attendees list in Google Calendar event transformation
* feat: implement organizer preservation logic in PATCH endpoint
- Fetch existing Google Calendar event data before transformation
- Extract organizer attendees from existing event and merge with user-provided attendees
- Prevent accidental removal of organizers when users update attendees
- Add custom interface for GoogleCalendarEventInputPipe to support optional existingEvent parameter
- Preserve organizers unless user explicitly provides hosts field in update request
Co-Authored-By: somay@cal.com <somay@cal.com>
* feat: add hosts array handling to PATCH endpoint
- Add hosts field back to UpdateUnifiedCalendarEventInput DTO
- Implement transformAttendeesWithHostsHandling method in GoogleCalendarEventInputPipe
- Convert hosts to attendees with organizer: true for Google Calendar API
- When hosts are provided, they replace existing organizers (not merge)
- Maintain backward compatibility with existing organizer preservation logic
Co-Authored-By: somay@cal.com <somay@cal.com>
* feat: implement sophisticated attendee update logic with preservation and deletion support
- Add UpdateCalendarEventAttendee class with action: 'delete' support
- Implement attendee preservation logic that starts with existing Google Calendar attendees
- Support explicit attendee deletion using action: 'delete' field
- Update existing attendees when provided without action field
- Add new attendees that don't exist in current event
- Preserve organizer status when updating existing attendees
- Fetch existing event data when attendees OR hosts are being updated
- Maintain hosts array handling that replaces existing organizers
Co-Authored-By: somay@cal.com <somay@cal.com>
* feat: add host management and attendee deletion to calendar event API
* refactor: improve readability of transformAttendeesWithHostsHandling and restrict hosts to responseStatus updates only
- Break down complex transformAttendeesWithHostsHandling method into smaller, more readable helper functions:
- preserveExistingAttendees: handles existing attendee preservation
- processAttendeeDeletions: handles attendee deletion logic
- processAttendeeUpdatesAndAdditions: handles attendee updates and additions
- replaceHostsWithUpdatedOnes: handles host replacement with restrictions
- Create UpdateCalendarEventHost class that only allows responseStatus updates
- Restrict hosts array to prevent changes to name, email, and other fields
- Preserve existing host displayName from Google Calendar when updating responseStatus
Co-Authored-By: somay@cal.com <somay@cal.com>
* feat: restrict host updates to responseStatus only, preserve email and name from Google Calendar data
- Remove email field from UpdateCalendarEventHost class
- Update replaceHostsWithUpdatedOnes to preserve all host data except responseStatus
- Apply responseStatus updates to all existing organizers from Google Calendar
- Prevent users from updating host email or name fields
Co-Authored-By: somay@cal.com <somay@cal.com>
* Revert "feat: restrict host updates to responseStatus only, preserve email and name from Google Calendar data"
This reverts commit 22d07ce0cb13e71661522b2fd8a237d8b6e0809c.
* feat: add comprehensive test suites for calendar transformation pipes
- Create google-calendar-event-input.pipe.spec.ts with 67 test cases
- Create get-calendar-event-details-output-pipe.spec.ts with 35 test cases
- Follow event-types transformer test patterns with separate describe blocks
- Cover all transformation functions including edge cases and null handling
- Test attendee preservation, deletion, host management, and status transformations
- Ensure comprehensive coverage for sophisticated attendee update logic
Co-Authored-By: somay@cal.com <somay@cal.com>
* refactor: replace optional flag with organizer property in calendar event attendees
* refactor: remove organizer field from calendar event attendee input
* fix: remove invalid optional properties from calendar pipe tests
- Remove optional: false from line 85 in 'should transform attendees without existing event' test case
- Remove optional: true from line 388 in 'should update existing attendee' test case
- Remove optional: false from line 421 in 'should add new attendee' test case
- Update expected outputs to match actual pipe implementation behavior
- All 30 tests now pass locally
Co-Authored-By: somay@cal.com <somay@cal.com>
* fix: complete shared Google event data with required properties for test suites
- Add missing required properties to sharedGoogleEvent in both test files
- Fix TypeScript compilation errors in calendar transformation pipe tests
- Correct test assertion for attendees filtering logic in output pipe
- All 11 test suites now pass with 199 tests total
Co-Authored-By: somay@cal.com <somay@cal.com>
* fix: resolve TypeScript compilation errors in calendar transformation pipe tests
- Add comprehensive Jest mocks for @calcom/prisma/client, @calcom/dayjs, CalendarManager, and delegationCredential
- Fix RedisService AbortSignal.timeout() usage
- Update UserAvailabilityService import path to use @calcom/lib/getUserAvailability
- Configure Jest moduleNameMapper to handle ES module imports and package.json mocking
- All 11 test suites now pass with 199 tests total
Co-Authored-By: somay@cal.com <somay@cal.com>
* fix: use proper CacheService dependency injection in AvailableSlotsService
- Replace direct CacheService instantiation with dependency injection
- Update CacheService import path to use correct calendar-cache module
- Fix repository and service dependencies for proper type safety
- Resolves TypeScript compilation errors in slots service tests
Co-Authored-By: somay@cal.com <somay@cal.com>
* fix: remove duplicate test file causing TypeScript compilation error
Co-Authored-By: somay@cal.com <somay@cal.com>
* undo extra changes
* undo extra changes
* fix: remove the action: "delete" key from attendees
* fix: simplify tests
* update docs
* undo: remove hosts
* Update pre-commit
* feat: add alternate route for calendar event retrieval and simplify test fixtures
* remove userId -- unused
* undo
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: somay@cal.com <somay@cal.com>
Co-authored-by: Somay Chauhan <somaychauhan98@gmail.com>
Co-authored-by: Volnei Munhoz <volnei.munhoz@gmail.com>
* refactor: move isRestrictionScheduleEnabled into AvailableSlotsService with DI
- Remove external isRestrictionScheduleEnabled function call from AvailableSlotsService
- Add IFeaturesRepository to IAvailableSlotsService interface dependencies
- Implement checkRestrictionScheduleEnabled private method within AvailableSlotsService
- Update DI module to inject featuresRepo dependency
- Update API v2 service to pass featuresRepository to base service
- Resolves TODO comment about implementing DI for isRestrictionScheduleEnabled
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* chore: bump platform libs
* fix: api v2 di for qualifiedHostsService
* chore: bump platform libs
* fix unit test
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: morgan@cal.com <morgan@cal.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
* refactor: convert findQualifiedHostsWithDelegationCredentials to service class with DI
- Create QualifiedHostsService class following UserAvailabilityService pattern
- Add IQualifiedHostsService interface with prisma and bookingRepo dependencies
- Create DI module and container for qualified hosts service
- Update filterHostsBySameRoundRobinHost to accept prisma as parameter
- Update all usage sites to use the new service:
- loadAndValidateUsers.ts
- slots/util.ts
- test mocks in _post.test.ts
- Maintain backward compatibility with original function export
- Fix type issues in team properties (rrResetInterval, rrTimestampBasis)
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* fix: update filterHostsBySameRoundRobinHost test to include prisma parameter
- Add missing prisma parameter to all test function calls
- Resolves unit test failure caused by function signature change
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* fix: resolve type issues in FilterHostsService
- Import PrismaClient type instead of using unknown
- Fix type compatibility for BookingRepository constructor
- Update test mocks to use proper BookingRepository type
- Ensure all DI dependencies are properly typed
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* refactor: rename DI files to CamelCase and update imports
- Rename all files in packages/lib/di from kebab-case to CamelCase
- Update 22 external files with import statements to use new file names
- Update internal DI module files with corrected imports
- Maintain consistency with TypeScript naming conventions
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* chore: bump platform libs
* chore: bump platform libs
* fix: remove obsolete vitest mock after service class refactoring
- Remove obsolete mock for old function module
- Keep correct mock for new DI container
- Resolves CI unit test failures
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* fix: correct import path for calAIPhone zod-utils module
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* fix: Booker active booking limit can't be switched off (#23005)
* refactor: Get rid of `getServerSideProps` for /getting-started pages (#23003)
* refactor
* fix type check
* fix: Remove Reporting page within Routing Forms (#22990)
* fix error in handleNewBooking (#23011)
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
* Documentation edits made through Mintlify web editor (#23007)
Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
* fix: Contact support button position changed from absolute to fixed (#23002)
* feat: Add private links to API (#22943)
* --init
* address change requests
* adding further changes
* address feedback
* further changes
* further clean-up
* clean up
* fix module import and others
* add guards
* remove unnecessary comments
* remove unnecessary comments
* cleanup
* sort coderabbig suggestions
* improve check
* chore: bump platform libraries
---------
Co-authored-by: Lauris Skraucis <lauris.skraucis@gmail.com>
Co-authored-by: supalarry <laurisskraucis@gmail.com>
* chore: release v5.5.15
* chore: bump platform libs
* chore: bump platform libs
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: morgan@cal.com <morgan@cal.com>
Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
Co-authored-by: Benny Joo <sldisek783@gmail.com>
Co-authored-by: Sahitya Chandra <sahityajb@gmail.com>
Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Co-authored-by: Ayush Kumar <kumarayushkumar@protonmail.com>
Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com>
Co-authored-by: Lauris Skraucis <lauris.skraucis@gmail.com>
Co-authored-by: supalarry <laurisskraucis@gmail.com>
Co-authored-by: emrysal <me@alexvanandel.com>
* feat: cal ai self serve architecture
* chore: add package
* chore: update evnet controller
* refactor: improvements
* chore: rename
* chore: type error and naming
* chore: just set it to nul
* chore: just set it to nul
* chore: some more improvements
* chore: packate version
* fix: API v2
* chore: change name of files
* chore: add select
* chore: add missing teamId
* chore: save progress
* refactor: split into multiple services
* refactor: make schema provider agonistic
* chore: improvements
* chore:
* chore: remove duplicate files
* chore: semicolon
* chore: formatting
* refactor: logging and error handling
* chore: rename variable
* refactor: use trpc error
* chore: replace with HttpError
* chore: remove from option
* We need the enum and not just the type
---------
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
* refactor: convert getBusyTimes to service class with dependency injection
- Create BusyTimesService following UserAvailabilityService pattern
- Add DI tokens, module, and container setup for BusyTimesService
- Update all usage locations to use service instead of direct function calls
- Maintain existing function signatures for backward compatibility
- Add legacy exports to ensure smooth transition
- Update type references in trpc util to use service prototype
- Fix linting issues by making legacy exports async with proper imports
- All tests pass and type checking succeeds
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* refactor: busy time service
* fix: api v2 eslint plugins version mismatch
* chore: bump platform libs
* chore: bump platform libs
* fix: missing di busyTimesModule in slots service
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: morgan@cal.com <morgan@cal.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
* refactor: move getTotalBookingDuration to BookingRepository
- Move getTotalBookingDuration function from standalone file to BookingRepository class
- Update all usage sites to call method through repository instance
- Remove standalone function file packages/lib/server/queries/booking/index.ts
- Add prisma import to util.ts for BookingRepository instantiation
- Maintain exact same method signature and functionality
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* fix: remove eslint-config-next to resolve TypeScript ESLint conflicts
- Remove eslint-config-next dependency that was causing version conflicts
- Resolves 'Class extends value undefined is not a constructor or null' errors
- ESLint 'next' config issue appears to be pre-existing in main branch
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* fixup! Merge branch 'main' into devin/move-getTotalBookingDuration-1754460208
* chore: bump platform libs
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: morgan@cal.com <morgan@cal.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
* feat: sync timezone with google/outlook for delegated credentials users
* chore: dynamic sync timezone in get availble slots
* redis cache for get delegated timezone
* Update packages/lib/getUserAvailability.ts
---------
Co-authored-by: Alex van Andel <me@alexvanandel.com>
* chore: Implement short-lived redis cache for slots
* chore: adapt apiv2 redis service to match with upstash redis
* chore: safer redis service and ms ttl
* fixup! chore: safer redis service and ms ttl
* Wrap with timeout, currently doesn't work yet
* Updated @upstash/redis for better signal support
* Fix type errors, remove ts value
* Inject NoopRedisService for NODE_ENV test
* chore: bump platform libs
* chore: bump platform libs
* Upstash Redis upgrade no longer resulted in expected hard crash on init, so updated factory and our Upstash Redis Adapter to mimick old behaviour
* Add SLOTS_CACHE_TTL variable for configurable ttl on slots cache
* Update parseInt to use right types
* chore: bump platform libs
* chore: bump platform libs
* chore: bump platform libs
* update e2e api v2 action
* set SLOTS_CACHE_TTL env var api v2 e2e
---------
Co-authored-by: cal.com <morgan@cal.com>
* refactor: getUserAvailability into service with DI
* chore: bump platform libs
* disable bull queue in e2e for bookings
* chore: bump platform libs
* chore: bump platform libs
* fix: should update event type bookingFields test
---------
Co-authored-by: Alex van Andel <me@alexvanandel.com>
* refactor: convert getShouldServeCache to CacheService with dependency injection
- Create CacheService class following AvailableSlotsService DI pattern
- Add FeaturesRepository and CacheService to DI tokens and modules
- Create cache container with proper dependency injection setup
- Update handleNewBooking.ts and slots/util.ts to use new service
- Maintain backward compatibility with error-throwing wrapper function
- Follow established service patterns for clean architecture
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* feat: inject CacheService into AvailableSlotsService via dependency injection
- Add cacheService to IAvailableSlotsService interface
- Update available-slots container to load cache modules
- Update available-slots module to inject CacheService dependency
- Replace direct getShouldServeCache call with injected service method
- Add CacheService import to util.ts for proper typing
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* chore: DI api v2 cache service
* refactor: convert FeaturesRepository to use factory pattern in DI
- Change from constructor injection to factory pattern to avoid PRISMA_CLIENT binding issues in tests
- FeaturesRepository now uses default prisma instance instead of DI injection
- Resolves test failures while maintaining DI container compatibility
- Tests reduced from 123+ failures to only 5 unrelated failures
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* revert: use direct FeaturesRepository instantiation in most usage points
- Revert getFeaturesRepository() calls back to new FeaturesRepository()
- Tests require direct instantiation for mocking compatibility
- Keep DI container for specific use cases that need dependency injection
- Resolves test failures while maintaining both DI and direct usage patterns
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* fix: resolve FeaturesRepository DI container issues
- Update cache module to use factory pattern with proper ICacheService interface
- Remove featuresModule loading from cache and available-slots containers
- Use direct FeaturesRepository instantiation via getFeaturesRepository()
- Resolves 'No binding found for key: Symbol(FeaturesRepository)' errors
- Reduces test failures from 125 to 7 (remaining failures appear unrelated)
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* fix: update all FeaturesRepository instantiations to include prisma parameter
- Add prisma parameter to all new FeaturesRepository() calls across the codebase
- Update API v2 services to match main repo interfaces
- Fix PrismaFeaturesRepository to implement IFeaturesRepository directly
- Update CacheService in API v2 to expose required dependencies and getShouldServeCache
- Implement CheckBookingLimitsService in API v2 with proper interface
- Resolves type assignment errors between API v2 and main repo implementations
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* fix: add prisma parameter to remaining FeaturesRepository instantiations in apps/web/lib
- Update getServerSideProps files to pass prisma parameter to FeaturesRepository
- Ensures all FeaturesRepository instantiations follow the new constructor pattern
- Completes the refactoring to use direct instantiation with prisma parameter
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* refactor clean and fix devin issues
* chore: bump platform libs
* chore: bump platform libs
* chore: bump platform libs
* chore: bump platform libs
* fix: missing di
* fix workflow test
* fix workflow test
* fix integration test
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: morgan@cal.com <morgan@cal.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
* Return a busy block placeholder if calendar throws an error
* Refactor `getCalendarsEvents` to return an object with a success prop
* Throw error in `getBusyTimes` if failed to fetch calendar availability
* Return empty available days if error getting busy times
* yeet.
* Type fix
* Fix type error in getLuckyUsers
* Type fixes
* Type fix
* Type fix
* Fix test
* Fix test mocks
* Refactor calendars.service to use new calendarBusyTimesQuery
---------
Co-authored-by: Alex van Andel <me@alexvanandel.com>
* refactor: convert checkBookingLimits to class service with dependency injection
- Create CheckBookingLimitsService class following AvailableSlotsService pattern
- Add countBookingsByEventTypeAndDateRange method to BookingRepository
- Move direct prisma calls from service to repository layer
- Implement dependency injection with proper DI tokens and modules
- Update all usage points to use the new service through DI
- Maintain backward compatibility with error-throwing wrapper functions
- Update tests to use the new service pattern
- Resolve TODO comment in AvailableSlotsService for DI integration
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* chore: DI CheckBookingLimitsService in v2 slots service
* chore: bump libraries
* chore: create getCheckBookingLimitsService
* refactor: convert checkBookingAndDurationLimits to service class with DI
- Create CheckBookingAndDurationLimitsService class following DI pattern
- Add DI tokens and module for the new service
- Update booking-limits container to provide the new service
- Refactor handleNewBooking.ts to use service through DI
- Maintain backward compatibility with deprecated function export
- Preserve all existing functionality while improving code organization
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* chore: CheckBookingAndDurationLimitsService
* chore: bump platform libs
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: morgan@cal.com <morgan@cal.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
* refactor: rename SelectedSlotsRepository to PrismaSelectedSlotRepository
- Rename class from SelectedSlotsRepository to PrismaSelectedSlotRepository for consistency
- Update all imports and type references throughout the codebase
- Update DI module bindings and variable names
- Maintain type safety without breaking changes
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* refactor: complete PrismaSelectedSlotRepository rename
- Update DI module binding property name from selectedSlotsRepo to selectedSlotRepo
- Update test mock to use PrismaSelectedSlotRepository class name
- Ensure all references are consistently updated
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* fix: rename file to prismaSelectedSlotRepository.ts and fix plural variable references
- Rename apps/api/v2/src/lib/repositories/prisma-selected-slots.repository.ts to prismaSelectedSlotRepository.ts
- Update class name from PrismaSelectedSlotsRepository to PrismaSelectedSlotRepository
- Fix plural variable reference selectedSlotsRepository to selectedSlotRepository in service
- Update all import paths to reference the new file name
- Maintain consistency with camelCase naming convention
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* fix: rename SelectedSlotsRepositoryFixture to SelectedSlotRepositoryFixture for consistency
- Rename test fixture class from SelectedSlotsRepositoryFixture to SelectedSlotRepositoryFixture (singular)
- Update all import statements in test files to use the renamed class
- Resolves naming mismatch between fixture class and variable declarations
- Fixes TypeScript compilation errors in CI tests
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* feat: add SelectedSlotRepositoryInterface and update DI to use interface
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* refactor: rename selectedSlots.ts to selectedSlot.ts and update all imports
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* fix: update test mock import path after file rename
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* Update apps/api/v2/src/lib/modules/available-slots.module.ts
* Update apps/api/v2/src/lib/modules/available-slots.module.ts
* Implement DTO
* dont declare dependencies locally, duplicating
* Small DTO/token fix
* chore: bump @calcom/platform-libraries from 0.0.266 to 0.0.267
* oops.
* Update fixture names also
* Omg these vscode actions preventing saves
* Final fix, hopefully
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Somay Chauhan <somaychauhan98@gmail.com>