* 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>
A progressive Node.js framework for building efficient and scalable server-side applications.
Description
Cal.com is using the Nest framework TypeScript starter repository.
Installation
$ yarn install
Prisma setup
$ yarn prisma generate
Env setup
Copy .env.example to .env and fill values.
Add license Key to Deployment table in DB
id, logo, theme, licenseKey, agreedLicenseAt:- 1, null, null, '00000000-0000-0000-0000-000000000000', '2023-05-15 21:39:47.611'
Replace with your actual license key.
your CALCOM_LICENSE_KEY env var need to contain the same value
.env CALCOM_LICENSE_KEY=00000000-0000-0000-0000-000000000000
Running the app
Development
$ yarn run start
OR if you don't want to use docker, you can run following command.
$ yarn dev:no-docker
Additionally you can run following command(in different terminal) to ensure that any change in any of the dependencies is rebuilt and detected. It watches platform-libraries, platform-constants, platform-enums, platform-utils, platform-types.
$ yarn run dev:build:watch
If you are making changes in packages/platform/libraries, you should run the following command too that would connect your local packages/platform/libraries to the api/v2
$ yarn local
watch mode
$ yarn run start:dev
production mode
$ yarn run start:prod
## Test
```bash
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# e2e tests in watch mode
$ yarn test:e2e:watch
# run specific e2e test file in watch mode
$ yarn test:e2e:watch --testPathPattern=filePath
# test coverage
$ yarn run test:cov
Conventions
Guards
- In case a guard would return "false" for "canActivate" instead throw ForbiddenException with an error message containing guard name and the error.
- In case a guard would return "false" for "canActivate" DO NOT cache the result in redis, because we don't want that someone is forbidden, updates whatever was the problem, and then has to wait for cache to expire. We only cache in redis guard results where "canAccess" is "true".
- If you use ApiAuthGuard but want that only specific auth method is allowed, for example, api key, then you also need to add
@ApiAuthGuardOnlyAllow(["API_KEY"])under the@UseGuards(ApiAuthGuard). Shortly, useApiAuthGuardOnlyAllowto specify which auth methods are allowed byApiAuthGuard. IfApiAuthGuardOnlyAllowis not used or nothing is passed to it or empty array it means that all auth methods are allowed.
Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Stay in touch
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
License
Nest is MIT licensed.