be249a94de226491206017c904890b98196cf21d
25
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
79a09362c9 |
refactor: remove circular dependency between prisma and app-store packages (#23475)
* refactor: remove circular dependency between prisma and app-store packages - Replace EventTypeAppMetadataSchema with z.record(z.any()).optional() pattern - Remove appDataSchemas import from packages/prisma/zod-utils.ts - Add null checks in consuming packages for flexible validation - Fix test file that no longer needs @ts-expect-error directive This breaks the circular dependency while maintaining all functionality by moving strict validation to the business logic layer where operations actually happen, following existing patterns in the codebase. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * refactor: remove EventTypeAppMetadataSchema exports from prisma package - Remove EventTypeAppMetadataSchema and eventTypeAppMetadataOptionalSchema exports from prisma/zod-utils.ts - Update all importing files to use local z.record(z.any()).optional() schemas - Replace type annotations with Record<string, any> where appropriate - Maintain validation functionality while breaking circular dependency - All TypeScript compilation now passes without errors Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * refactor: complete removal of EventTypeAppMetadataSchema from remaining files - Update handleSeats/createNewSeat.ts to use local schema - Update payment handlers to use local schemas - Update eventTypes update handler to use local schema - All files now define their own validation instead of importing from prisma - Circular dependency completely eliminated Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: resolve TypeScript compilation errors - Remove duplicate z import from handleConfirmation.ts - Remove duplicate appDataSchemas import from update.handler.ts - Fix index signature errors in handlePayment.ts by using appData variable consistently - All type checks now pass successfully Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: add type casting for appSlug in eventTypeService - Cast appSlug as keyof typeof apps to resolve index signature error - Maintains type safety while allowing dynamic property access Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix * remove * make zod-utils.ts in app-store * update imports * fix * fix * fix * revert unrelated change * update imports * fix * fix * revert * fix * fix --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: hbjORbj <sldisek783@gmail.com> |
||
|
|
c28eb90928 |
chore: Upgrade prisma to 6.7.0 (#21264)
* chore: Upgrade prisma to 6.7.0 * Build fixes * type fixes Signed-off-by: Omar López <zomars@me.com> * Update schema.prisma * Patching * Revert "Update schema.prisma" This reverts commit 47d8618bf89ef4d007b30084df766f17281e21a1. * Revert "Patching" This reverts commit a1d2e3040e71690a44d4324db95d73b4d68c6adb. * Revert schema changes Signed-off-by: Omar López <zomars@me.com> * WIP Signed-off-by: Omar López <zomars@me.com> * Update getPublicEvent.ts * Update imports Signed-off-by: Omar López <zomars@me.com> * Update gitignore Signed-off-by: Omar López <zomars@me.com> * update remaining imports Signed-off-by: Omar López <zomars@me.com> * Delete .cursor/config.json * Discard changes to packages/features/eventtypes/lib/getPublicEvent.ts * Update _get.ts * Update user.ts * Update .gitignore * update * Update WorkflowStepContainer.tsx * Update next-auth-custom-adapter.ts * Update getPublicEvent.ts * Update workflow.ts * Update next-auth-custom-adapter.ts * Update next-auth-options.ts * Update bookingScenario.ts * fix missing imports * upgrades prismock Signed-off-by: Omar López <zomars@me.com> * patches prismock Signed-off-by: Omar López <zomars@me.com> * Update reschedule.test.ts * Update prisma.ts * patch prismock Signed-off-by: Omar López <zomars@me.com> * fix enums imports Signed-off-by: Omar López <zomars@me.com> * Revert "Update prisma.ts" This reverts commit 64edcf8db54171ff4456c209d563b5d431d99619. * Revert "patch prismock" This reverts commit e95819113dc9d88e7130947aa120cd42710977c8. * fix patch * Fix test that overrun the boundary, it shouldn't test too much * Move prisma import to changeSMSLockState * Bring back broken test without illegal imports * Merge with main and fix filter hosts by same round robin host * Fixed buildDryRunBooking fn tests * Fix and move ooo create or update handler test * Fix packages/features/eventtypes/lib/isCurrentlyAvailable.test.ts * Fix packages/trpc/server/routers/viewer/organizations/listMembers.handler.test.ts * Mock @calcom/prisma * Fix: verify-email.test.ts * fix: Moved WebhookService test and fixed default import mock * Fix: Added missing prisma mock, handleNewBooking uses that of course * We're not testing createContext here * fix: Prisma mock fix for listMembers.test.ts * More fixes to broken testcases * Forgot to remove borked test * Prevent the need to mock a lot of dependencies by moving out buildBaseWhereCondition to its own file * Temporarily skip getCalendarEvents, needs a rewrite * Fix: turns out you can access protected in testcases * fix further mocks * Added packages/features/insights/server/buildBaseWhereCondition.ts, types * Always great to have a mock and then not use it * And one less again. * fix: confirm.handler.test, didn't mock prisma * fix: Address minor nit by @eunjae & fix ImpersonationProvider test * Updated isPrismaAvailableCheck that doesn't crash on import * fix: Get Prisma directly from the client, it usually involves the Validator and does not need 'local' inclusion * Add zod-prisma-types without the generator enabled (commented out) * Uncomment and see what happens * Change method of import as imports did not work in Input Schemas * Remove custom 'zod' booking model, it does not belong with Prisma * Fix all other global Model imports * Rewrite most schema includes AND remove barrel file * Add bookingCreateBodySchema to features/bookings * Flurry of type fixes for compatibility with new zod gen * Refactor out the custom prisma type createEventTypeInput * Work around nullable eventTypeLocations * HandlePayment type fix * More fixes, final fix remaining is CompleteEventType * Should fix a bunch more booking related type errors * Missed one * Some props missing from BookingCreateBodySchema * Fix location type in handleChildrenEventTypes * Little bit hacky imo but it works * Final type error \o/ * Forgot to include Prisma * Do not include zod-utils in booker/types * Oops, was already including Booker/types * Fix membership type, also disallow updating createdAt/updatedAt, make part of patch/post * Fix api v1 type errors * Fix EventTypeDescription typings * Remove getParserWithGeneric, use userBodySchema with UserSchema * use centralized timeZoneSchema * Implement feedback by @zomars * Couple of WIP pushes * Fix tests * Type fixes in `handleChildrenEventTypes` test * Try and parse metadata before use * Change zod-prisma-types configuration for optimal performance * Fix prisma validator error in `prisma/selects/credential` * Disable seperate relations model, hits a bug * Import absolute - this makes rollup work in @platform/libraries * Attempt at removing resolutions override * Refactor using `Prisma.validator` to `satisfies` * Build atoms using @calcom/prisma/client * Build atoms using @calcom/prisma/client * fixes * Update eventTypeSelect.ts * Adjust `eventTypeMetaDataSchemaWithUntypedApps` from `unknown` to `record(any)` * `EventTypeDescription` rely on `descriptionAsSafeHTML` instead of `description` * Add `seatsPerTimeSlot` to event type public select * Fix typing in `users-public-view` getServerSide props * Add missing `schedulingType` to prop * chore: bump platform libraries * Function return type is illegal, not sure how this passed eslint (#21567) * Merged with main * Update updateTokenObject.ts * Update handleResponse.ts * Update index.ts * Update handleChildrenEventTypes.ts * Update booking-idempotency-key.ts * Update WebhookService.test.ts * Update events.test.ts * Update queued-response.test.ts * Update events.test.ts * Update getRoutedUrl.test.ts * fix: type checks Signed-off-by: Omar López <zomars@me.com> * fixes Signed-off-by: Omar López <zomars@me.com> * chore: bump platform libraries * Update yarn.lock * more fixes Signed-off-by: Omar López <zomars@me.com> * fixes Signed-off-by: Omar López <zomars@me.com> * biuld fixes * chore: bump platform libraries * Update conferencing.repository.ts * Update conferencing.repository.ts * Update getCalendarsEvents.test.ts * Update vite.config.js * chore: bump platform libraries * Update users.ts * Discard changes to docs/api-reference/v2/openapi.json * Update vite.config.ts * updated platform libraries * Update get.handler.test.ts * Update get.handler.test.ts * Update schema.prisma * Discard changes to docs/api-reference/v2/openapi.json * Update next-auth-custom-adapter.ts * Update team.ts * Flurry of type fixes * Fix majority of insight related type errors * Type fixes for unlink of account * Make user nullable again * Fixed a bunch of unit tests and one type error * Attempted mock fix * Attempted fix for Attribute type * Ensure default import becomes prisma, but not direct usage * Import default as prisma in prisma.module * Add attributeOption to attribute type * Fix calcom/prisma mock * Refactor Prisma client imports to @calcom/prisma/client Updated all imports from '@prisma/client' to '@calcom/prisma/client' across tests and repository files for consistency and to use the correct Prisma client package. This change improves maintainability and ensures the correct client is referenced throughout the codebase. * Undo removal of max-warnings=0 to get main to merge * Remove unit tests for e2e fixtures, provide new prisma mock * Mock @calcom/prisma in event manager * Mock @calcom/prisma in event manager * Add correct format even with --no-verify * Mock prisma in CalendarManager * Add mock for permission-check.service * Better injection in PrismaApiKeyRepository imports * More mock fixes :) * Fix listMembers.handler.test * Fix User import * Appropriately adjust all types to be imported as types, there were a lot of types imported as normal deps * Why was this a thing? * Strictly speaking; Not using prismock anymore * Ditched patch file for prismock * Fix output.service.ts platform type imports, need concrete for plainToClass * Better typing and tests for unlinkConnectedAccount.handler * Small type fix * Disable calendar cache tests as they are dependent on prismock * chore: bump platform lib * getRoutedUrl test remove of unused import * Extract select to external const on getEventTypesFromDB * Direct select of userSelect from selects/user * fix type error from merging 23653 * Fixed integration tests by removing hardcoded values that were possible due to mocking, but as its now directly hitting the db no longer * fix: vite config atoms prisma client type location * revert: example app prisma client * revert: example app prisma client * bump platform libs * fix: use class instead of type for DI of PlatformBookingsService * update platform libs * remove unused variable * chore: generate prisma client for api v2 * fix: api v2 e2e * fix: atoms e2e * fix: atoms e2e * fix: atoms e2e * fix: api v2 e2e * fix: tsconfig apiv2 enums * publish libraries * Simplify check for existence teamId --------- Signed-off-by: Omar López <zomars@me.com> Co-authored-by: Alex van Andel <me@alexvanandel.com> Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com> Co-authored-by: supalarry <laurisskraucis@gmail.com> Co-authored-by: cal.com <morgan@cal.com> Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com> Co-authored-by: Benny Joo <sldisek783@gmail.com> |
||
|
|
2b29b5607d | Add logs to cancellation flow (#23585) | ||
|
|
18a0e2d75c |
fix: event not removed from calendar when reassigned (#23099)
* fix: event not removed from calendar when reassign * fix test * tweak * add test * test: add comprehensive test for calendar event deletion during round robin reassignment - Remove existing tests and replace with focused test for organizer change scenario - Verify deleteEventsAndMeetings is called when organizer changes - Mock reschedule method to simulate real behavior while tracking deletion calls - Test verifies original host's calendar events are properly deleted - Ensures booking reassignment and email notifications work correctly Co-Authored-By: anik@cal.com <adhabal2002@gmail.com> * update * revert roundRobinReassignment.test.ts * revert --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
1914b37ee4 |
feat: add PATCH endpoint for updating Google Calendar events (#22339)
* 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> |
||
|
|
c20e723e34 |
fix: resolve credential mismatch in round robin reschedule causing 404 errors (#22993)
* fix: flaky e2e * fix: resolve credential mismatch * test: add comprehensive credential mismatch test for round robin reschedule - Verify original host credentials used for deletion operations - Verify new host credentials used for creation operations - Test dual EventManager pattern implementation - Fix timeFormat property access issue Co-Authored-By: anik@cal.com <adhabal2002@gmail.com> * Update handleNewBooking.ts * Update booking.ts * Update handleNewBooking.ts * update * Update booking.ts --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
242f86891a |
fix: MSTeams not created as online meetings (#21377)
* fix MSTeams formatting and duplicate events * update without changing scopes, create onlineMeetings through CalendarService instead of VideoApiAdapter * get url after online meeting is created required for downstream * fallback to callvideo if only MSteams and update evt.videoCallData with url * for backward compatibility set explicitly 'Microsoft Teams Meeting' for old meetings if rescheduled * add dependency to msTeams App * nit * use interpolation * update to create MSTeams event if only MSTeams installed and not Outlook Calendar * make function MSTeams specific --------- Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> |
||
|
|
1d1a242a72 |
refactor: convert getShouldServeCache to CacheService with dependency injection (#22814)
* 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> |
||
|
|
4dc22606d9 | fix: create new meeting room (#22591) | ||
|
|
f117b2df32 |
fix: CalDAV credential verification between multiple instances (#22331)
Co-authored-by: zomars@cal.com <zomars@me.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
4920abdaf7 |
feat: optimize Prisma queries by replacing findFirst with findUnique where applicable (#21826)
* feat: optimize Prisma queries by replacing findFirst with findUnique where applicable - Replace findFirst/findFirstOrThrow with findUnique/findUniqueOrThrow for queries using unique constraints - Maintain existing functionality and error handling behavior - Focus on queries using primary keys and unique index fields from schema - Revert problematic changes that caused test failures to maintain stability Co-Authored-By: benny@cal.com <benny@cal.com> * revert: exclude API files from Prisma query optimizations per user request - Reverted all 55 API-related files to their original state - Kept all non-API Prisma query optimizations intact - API files include apps/api/v1, apps/api/v2, apps/web/app/api, and packages/app-store/*/api - Non-API optimizations remain for packages/lib, packages/features, apps/web (non-api), etc. Co-Authored-By: benny@cal.com <benny@cal.com> * feat: optimize membership query in attributeUtils to use findUnique with userId_teamId constraint Co-Authored-By: benny@cal.com <benny@cal.com> * revert: exclude test files from Prisma query optimizations per user request Co-Authored-By: benny@cal.com <benny@cal.com> * revert: revert attributeUtils.ts to use findFirst for test compatibility Co-Authored-By: benny@cal.com <benny@cal.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: benny@cal.com <benny@cal.com> Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> |
||
|
|
4a53ec0b74 |
feat: platform toggle calendar event creation (#21788)
* feat: add areCalendarEventsEnabled to PlatformOAuthClient table * feat: areCalendarEvents enabled in handleNewBooking and v2 * feat: v2 handle areCalendarEventsEnabled * feat: toggle areCalendarEventsEnabled on frontend * feat: enable areCalendarEventsEnabled for recurring,confirm,paid * refactor: use placeholder calendar event * remove merge conflicts * chore: bump libraries * chore: bump libraries |
||
|
|
6f1eaaa02e |
fix: Create separate calendar events to hide organizer (#21555)
* Add notes to `EventManager.create` * Create `CalendarServiceEvent` * Generate calendar description and remove attendees if event is private in `CalendarManager` * Process event for reschedule method * Refactor calendar services * Clean up comment * Type fixes * Type fix * Type fix |
||
|
|
7f9709bdaa |
fix: typos in packages/ (#21216)
Found via codespell Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> |
||
|
|
c52bbc4be3 |
fix: meeting link fails when host requests to reschedule (#20999)
* fix: meeting link fails when host requests to reschedule * Update EventManager.ts |
||
|
|
e3bd90c4f2 |
fix: Handle calendar-cache with Delegation Credentials
Fixes CAL-5372 # Delegation Credentials with CalendarCache. Following content is a snapshot of the [internal document](https://calendso.slack.com/docs/T08B8KA2BNF/F08L5JYU3V3) **Problem-1 :** CalendarCache needs SelectedCalendar records to work but SelectedCalendar record is only created when a user connects their calendar and then enables some calendar for conflict checking. Because with Delegation, no manual connection is done by any of the members, we need a way to create SelectedCalendar records automatically. **Problem-2** CalendarCache connects to credential(regular credential) which doesn’t exist for Delegation Credential scenario. Also, DelegationCredential is common for all the members(different from Credential which is different for different members) of the organization and we need to identify to which user the CalendarCache belongs. **Solution for both problems** - Create credential records for Delegation Credentials as well - Through Cron(new - we could schedule it every 5mins) - Now create SelectedCalendar records for those Credential records - Through another Cron(new - we could schedule it every 5mins) - Now CalendarCache records will automatically be created for those SelectedCalendar records -existing cron ## Fixed some Delegation Credentials bugs unrelated to calendar-cache - If DestinationCalendar wasn't set(which is possible only with Delegation Credentials), then Google Meet wasn't used as a conferencing app - [Added a test] - If no SelectedCalendar is there but Google Calendar connection exists(possible only with Delegation Credential) then we were not doing conflict checking. It is expected to not do it for Regular Credentials, but for Delegation Credential we must check for conflict in that case too [Added a test] - Earlier if a user has Regular Credential as well as Delegation Credential for the same external id which is the member email(say member1@acme.com) then availability were retrieved twice because we weren't deduplicating credentials as it wasn't a trivial thing to do. Now that is being done. **Env Variables:** Note this PR doesn't introduce any new env variable. The existing env variable has been added to .env.example. But if this env variable isn't already set, it must be set. `CALCOM_SERVICE_ACCOUNT_ENCRYPTION_KEY={SAME_AS_SET_FOR_V2_API}` **Deployment Plan:** 1. Add Observability for SelectedCalendar when _error_ field is set 2. Follow https://github.com/calcom/cal.com/blob/calendar-cache-dwd-support/apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/delegation-credential/delegation-credential.md#setting-up-delegation-credential-for-google-calendar-api to enable Delegation Credential for i.cal.com 3. Note that to be able to see the option to enable Delegation Credential for an organization, you need to enable `teamFeature` and `feature` for `delegation-credential` ## Automation Tests - Introduced tests for calendar-cache.repository.ts - Tests all methods of the repository - Added more tests for handleNewBooking/delegation-credential flow. - Added test to verify the bug fix when no DestinationCalendar exists and Google Meet should be used still - Added more tests for Google Calendar/CalendarService targeting DelegationCredential - Added more tests for getCalendarsEvents. - To test the new logic of calling getAvailability still if there are no selectedCalendars in case of Delegation Credential - Also introduced tests for `getAvailabitlityWithTimezones` which was an existing function but now has some new changes. - Added tests for deduplication logic in CalendarManager.ts ## How to Test Enable Calendar Cache and Delegation Credential feature for acme org through `features` and `teamFeatures` tables. - Enable Delegation Credential for acme org - Enable atleast 1 calendar for conflict checking for one of the users(say owner1) - Ensure GOOGLE_WEBHOOK_TOKEN is set in .env file - Ensure GOOGLE_WEBHOOK_URL is set to ngrok url of webapp in .env file - Hit cron endpoint `curl http://localhost:3000/api/calendar-cache/cron\?apiKey\={API_KEY}` that would cache the freebusy result for the selected calendars Followup - https://github.com/calcom/cal.com/pull/20698 - https://github.com/calcom/cal.com/pull/18619/files#r2046795643 |
||
|
|
7dfb71ca30 |
fix: Location not changing when rescheduling (#20404)
* fix: location not chnging * update * update * Update EventManager.ts * update * update * Update reschedule.test.ts --------- Co-authored-by: Tushar Bhatt <95581504+TusharBhatt1@users.noreply.github.com> Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> |
||
|
|
46f979ba6d |
chore: Add logging and try/catch blocks in handleNewBooking (#20665)
* Add logging and try/catch blocks * Add additional logging around `deleteEventsAndMeetings` * Type fix |
||
|
|
b3d5a6edca |
feat: Salesforce - on booking cancel, write to event object (#20601)
* Type app options * Refactor `writeToPersonRecord` to `writeToRecord` * Abstract writing to salesforce record options component * Add option to write to event object on cancellation * Add on booking cancel write to event object to schema * Refactor writing to record on booking option to use `<WriteToObjectSettings />` * Pass event object to crm delete method * When cancelling booking write to event object - App data isn't being read * V1 pass app data to crm service * Undo .env commit * Fix passing event to cancel crm cancel event method * Pass event type metadata to `EventManager` in `handleCancelBooking` * Handle writing to event record * Type fix |
||
|
|
40333c81c5 |
chore: Add logging to Salesforce (#20167)
* Remove unused param * Add log when no contacts are created * Replace console.log with logger * Add logging around `buildRecordUpdatePayload` * Add details if field isn't being caught * Revert change * Type fixes --------- Co-authored-by: Keith Williams <keithwillcode@gmail.com> |
||
|
|
b0e3cc4dd2 | chore: add logs for debugging (#19851) | ||
|
|
524c0d81a7 |
chore: rename DWD to DelegationCredential (#19744)
* Revert "Revert "chore: rename DWD to DelegationCredential (#19703)" (#19734)"
This reverts commit
|
||
|
|
340b5ab061 |
Revert "chore: rename DWD to DelegationCredential (#19703)" (#19734)
This reverts commit
|
||
|
|
7a9ddf2194 |
chore: rename DWD to DelegationCredential (#19703)
* chore: rename DWD to DelegationCredential * fixup! chore: rename DWD to DelegationCredential * fixup! fixup! chore: rename DWD to DelegationCredential * fixup! Merge branch 'main' into rename-domain-wide-delegation * fixup! fixup! Merge branch 'main' into rename-domain-wide-delegation * fixup! fixup! fixup! Merge branch 'main' into rename-domain-wide-delegation |
||
|
|
7180eb067a |
refactor: Move @calcom/core to @calcom/lib (#19655)
* refactor: Move @calcom/core to @calcom/lib * Merging imports * Clean up * Ignoreing type error for now |