* feature to enable optimized slots
* type check (was not caught running locally)
* update for typechecks
* update for type checks
* initialize form
* update slots test for showOptimizedSlots
* added some more tests
* handled edge case
* added test for edge case
* generalized condition
* refactored instead of ternary and added comments
* update condition
* Update apps/web/public/static/locales/en/common.json
Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>
* moved showOptimizedSlots setting to advanced tab
* updated to always move to next 15min if not possible to next interval
* correct after merge
* chore
* fix typecheck after latest merges
* remove workinghours when dateRanges input
* refactor: extract to fn
* chore
* remove unrelated changes
* remove unrealted change
* updated tests
* unrelated format changes no-verify
* unrelated format changes no-verify
* handle current day booking cases, to show roundedoff minutes
* remove unrelated format changes in openapi.json
* add test for new condition
* remove unrelated auto-format changes
* remove unrelated auto-format changes
* update after merge
* For current day bookings, normalizing the seconds to zero to avoid issues with time calculations
* Update packages/platform/atoms/event-types/hooks/useEventTypeForm.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* update for typecheck due to latest changes
* resolve merge conflicts
* Smaller description
* Minor style change to prefer early return
---------
Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>
Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
Co-authored-by: Devanshu Sharma <devanshusharma658@gmail.com>
Co-authored-by: Volnei Munhoz <volnei.munhoz@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
* perf: optimize video adapter imports to avoid loading entire app store
- Creates VideoApiAdapterMap with lazy imports for 12 video services
- Updates getVideoAdapters function to use VideoApiAdapterMap instead of dynamic app store imports
- Preserves zoom app name parsing logic (zoom_video → zoomvideo)
- Follows same optimization pattern as calendar, analytics, and payment services
- Reduces bundle size by avoiding import of 100+ apps when only video functionality needed
Affected files:
- packages/app-store-cli/src/build.ts: Added video service generation logic
- packages/lib/videoClient.ts: Updated to use VideoApiAdapterMap
- packages/features/bookings/lib/handleCancelBooking.ts: Updated FAKE_DAILY_CREDENTIAL import
- packages/lib/EventManager.ts: Updated FAKE_DAILY_CREDENTIAL import
- packages/trpc/server/routers/viewer/calVideo/getMeetingInformation.handler.ts: Updated to use VideoApiAdapterMap
- apps/web/lib/video/[uid]/getServerSideProps.ts: Updated daily video function imports
- packages/app-store/video.services.generated.ts: Generated video adapter map with re-exports
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: add missing re-exports to video.services.generated.ts
- Updates build.ts to include FAKE_DAILY_CREDENTIAL and other daily video function re-exports
- Fixes type errors in EventManager.ts and other files importing from video.services.generated
- Ensures video adapter refactoring maintains all existing functionality
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: update video adapter test mocks to work with VideoApiAdapterMap
- Creates global mockVideoAdapterRegistry for dynamic video adapter mocks
- Uses Proxy in vi.mock for VideoApiAdapterMap to return registered mocks
- Updates mockVideoApp and mockErrorOnVideoMeetingCreation to register mocks
- Fixes unit test failures in booking scenario tests
- Ensures video meeting operations (createMeeting, updateMeeting, deleteMeeting) work correctly
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: remove re-exports from video.services.generated.ts and revert imports
- Remove re-export block from video.services.generated.ts as requested
- Revert imports back to pull directly from dailyvideo/lib/VideoApiAdapter
- Update build.ts to not generate the re-exports
- Maintains all existing functionality while addressing GitHub feedback
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: rename video.services.generated.ts to video.adapters.generated.ts
- Updates build.ts to generate video.adapters.generated.ts instead of video.services.generated.ts
- Updates all import statements to use new filename
- Removes unnecessary mock exports from bookingScenario.ts (FAKE_DAILY_CREDENTIAL, etc.)
- Addresses GitHub comments from @keithwillcode on PR #23435
The terminology change from 'services map' to 'adapters map' better reflects
the actual content (video adapters, not services) and maintains consistency
with the established refactoring pattern.
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* refactor: rename videoServices to videoAdapters and simplify return statement
- Rename variable from videoServices to videoAdapters for consistency
- Remove unnecessary const variable and return directly in same line
- Addresses GitHub comments from @keithwillcode on PR #23435
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-08-29 14:21:05 +09:00
Keith WilliamsGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* perf: optimize payment app imports to avoid loading entire app store
- Add PaymentServiceMap generation to app-store-cli build process
- Generate payment.services.generated.ts with lazy imports for 6 payment services
- Update handlePayment.ts, deletePayment.ts, handlePaymentRefund.ts to use PaymentServiceMap
- Update getConnectedApps.ts and tRPC payment routers to use PaymentServiceMap
- Follow same pattern as analytics optimization in PR #23372
- Reduces bundle size by avoiding import of 100+ apps when only payment functionality needed
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* Update build.ts
* fix: update payment service test mocking to work with PaymentServiceMap
- Remove obsolete appStoreMock line from bookingScenario.ts since handlePayment now uses PaymentServiceMap
- Update setupVitest.ts to import prismaMock from correct PrismockClient instance
- Add PaymentServiceMap mock following PR #22450 pattern for calendar services
- Ensure MockPaymentService uses consistent externalId across test files
- Fix webhook handler to return 200 status by ensuring payment records are found correctly
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: revert prismaMock import to avoid interfering with other tests' vi.spyOn() calls
- Remove global prismaMock import from setupVitest.ts that was causing 'is not a spy' errors
- Update MockPaymentService to import prismaMock locally to maintain payment test functionality
- Fixes organization and outOfOffice tests while preserving payment service optimization
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: remove E2E conditional check from payment services map generation
- Payment services map now always includes all payment apps regardless of E2E environment
- Ensures payment functionality is consistently available across all environments
- Addresses CI failures caused by conditional payment service loading
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* refactor: use direct PaymentService imports instead of .lib structure
- Update app-store-cli to import directly from lib/PaymentService.ts files
- Modify all payment handlers to access PaymentService directly
- Update test mocks to match new direct import structure
- Remove .lib property access pattern across payment system
- Maintain backward compatibility while improving import efficiency
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: revert chargeCard booking.id parameter additions
- Remove booking.id parameter from chargeCard calls in chargeCard.handler.ts and payments.tsx
- Addresses GitHub feedback to investigate chargeCard signature changes in separate PR
- Keeps all other direct PaymentService import refactor changes intact
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: improve cancellation email of reschedule RR booking
* fix failing test
* fix: uses same lucky user when rescheduling RR booking also has a fixed host
* chore
* chore
* better message in the cancelled email
* fix
* fix
* add booker rescheduled in reassigned email to old host
* test
* add reassigned subtite
* fix: use same lucky user when reschedule RR booking has a fixed host
* fix: test
* fix: subtitle
---------
Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
* perf: implement quick app store loading optimizations
- Add conditional app store imports in videoClient and handlePayment
- Implement lazy calendar manager pattern in CalendarManager
- Enhance createCachedImport with better concurrency handling
- Create calendar-only registry for common calendar operations
- Add performance instrumentation for debugging
These optimizations reduce initial app store loading time by avoiding
module-level imports and creating smaller, focused registries for
calendar operations.
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: revert getCalendar to use appStore for proper test mocking
- Reverted getCalendar.ts to use main appStore instead of calendarStore
- This ensures test mocking system works properly with existing appStoreMock
- Fixes unit test failures where Google Calendar references were getting null values
- All collective scheduling tests now pass
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* perf: implement CalendarServiceMap for optimized calendar loading
- Add CalendarServiceMap generation following CrmServiceMap pattern
- Update getCalendar.ts to use generated calendar service map
- Remove manual calendar-registry.ts in favor of auto-generated approach
- Reduces calendar initialization from loading 48+ apps to ~10 calendar apps
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: update test mocks for CalendarServiceMap compatibility
- Add missing SelectedCalendar fields (createdAt, updatedAt, lastErrorAt, watchAttempts, etc.)
- Fix CredentialPayload type errors by adding user.email and delegationCredentialId
- Mock CalendarServiceMap to use vi.importActual for real calendar services
- Ensure calendar service tests work with new lazy loading approach
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: resolve CalendarServiceMap test compatibility issues
- Update getCalendarsEvents.test.ts mocks to work with CalendarServiceMap dynamic imports
- Add missing SelectedCalendar fields (createdAt, updatedAt, lastErrorAt, watchAttempts, etc.)
- Fix CredentialPayload type errors by adding user.email and delegationCredentialId
- Use type assertion in getCalendar.ts to resolve credential type conflicts
- Ensure calendar service tests work with new lazy loading approach
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: update test mocking for CalendarServiceMap compatibility
- Add comprehensive vi.mock for calendar.services.generated in delegation-credential tests
- Mock GoogleCalendarService and Office365CalendarService with proper return values
- Update all test files to use await with mockCalendarToHaveNoBusySlots
- Ensure calendar events return expected meetingId, meetingPassword, meetingUrl values
- Fix async/await compatibility issues in booking scenario test utilities
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: resolve TypeScript errors in CalendarServiceMap mocking
- Extract CalendarServiceMap promise to variable to fix 'always true' condition
- Ensure vi.mocked is called on Promise type for proper mockResolvedValue access
- Add await keywords to calendar mock calls in test files
- Maintain existing functionality while making code type-safe
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* Remove Exchange 2013 and 2016
* Mock Exchange in all tests
* Fix tests
* Remove exchange 2013 and 2016 from app store index
* Fix merge error
* Await when getting calendar service
* Fix selectedSlot test
* Add missing variable
* Update openapi.json
* Updated CalendarService imports
* try again
* WIP migrate calendar apps to ES6
* Revert "WIP migrate calendar apps to ES6"
This reverts commit 15bf2c83305e82050779d0bca3380fa9573db1e0.
* Revert changes back to e23991024a5a455c14aa05f100a5b56288db343a
This reverts all calendar service changes that were causing circular dependency issues during builds and E2E tests.
* Remove circular dependency for location constants
* Update yarn.lock with removed package
* Add empty map when running E2E
* Type fies
* Fix merge conflict
* Remove logging statements
* Throw error and reset state if failing to load app
* Revert "Remove Exchange 2013 and 2016"
This reverts commit fedaf6346bd9e4c63337276d5a6f9e8c3943056c.
* Re-introduce exchange{2013,2016}
Revert the removal in app-store/index.ts also.
* Trying to fix tests
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Alex van Andel <me@alexvanandel.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>
* add Add Group button
* add host groups to schema
* UI for host groups
* raname groups to hostGroups
* schema update
* show groups in assignment tab
* add no group hosts to Group 1
* add dummy group for non group hosts
* fix type errors
* use two dimensional array for luckyUserPools
* fix empty array
* group RR hosts in handleNewBooking
* improve logic for grouping lucky users
* find all lucky users of all groups
* allow several RR hosts on booking
* clean up migrations
* create helper function
* group hosts for slots logic
* add group logic to loading available slots
* adding hosts to groups
* add groupId to hostSchema
* disable hosts from other groups
* handle groups in checkedTeamSelect
* fix adding hosts to groups
* remove and add groups
* show hosts if there are no groups
* fixing adding first group with existing hosts
* show groups empty groups correctly
* UI upddate fixes
* fix adding hosts to existing first host group
* small fixes + code clean up
* add availability fix with test
* create new round-robin test file
* disable reassignment
* fix losing fixed hosts
* fix updating weights and priorities
* disable load balancing with Round Robin Groups
* automatically disable load balancing in update handler
* allRRHosts should only include hosts from same group
* fix type errors
* fix type error
* fix tests
* fix type error
* remove undefined from groupId type
* type changes
* add tests for hostGroups
* add tests for host groups
* fixes
* fix type errors with undefined groupId
* remove seperate host groups prop
* fix editing weights
* remove console.log
* code clean up
* improve getAggregatedAvailability tests
* throw error when no available hosts in a group
* add fixme comment
* create constant for DEFAULT_GROUP_ID
* clean up code
* mock default_group_id for unit tests
* don't show fixed hosts in edit weights side bar
* add DEFAULT_GROUP_ID to mock test-setup
* remove unused index variable
* code clean up
* fix updating host groups
* fix imports
* add default_group_id to mocks
* add uuid() to zod schema
* remove unused code
* fix singular translation key
* remove unnessary !!
* Revert formatting changes
* add additional tests for bookingActions
* use createMany
* import DEFAULT_GROUP_ID for mocks
* fix mocks
* clean up EventTeamAssignmentTab
* fix type errors in tests
* fix mocks
* remove constants.example.test.ts
* fix type error
* add missing groupId
* fix margin
* clean up empty host groups
* fix constants mock
* useCalback
* use reduce
* extract handlers into seperate functions
* fix handler functions
* fix border radius
* fix type error in CheckForEmptyAssignment
* fix type error
---------
Co-authored-by: CarinaWolli <wollencarina@gmail.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>
* init
* fix type
* fix a re-render infinite loop because of missing readOnly (╯°□°)╯︵ ┻━┻)
* further fixes
* improvement
* fix expiry datetime check
* remove unnecessary prismaMock def
* revert
* fix test
* add test ids
* remove unit tests in favor of e2e
* e2e test update
* fix e2e
* fix e2e
* remove unnecessary change
* abstract into injectable object
* further improvements
* fix label not selecting radio
* fix type
* code improvement
* DI implementation
* fix type
* fix quick copy
* code improvement and a few fixes
* further improvements and NITS
* further into DI
* select
* improve link list sorting
* prep for easier conflict resolution
* add back translations
* using useCopy instead
* improvement
* add index to update salt and have different hash generation
* fix private link description
* fix increment regression in expiry logic
* fixes
* address feedback
* use extractHostTimezone in event type listing
* remove unused function
* remove translationBundler
* -_-
* address feedback
* further changes
* address more feedback
* NIT
* address improvement suggestions
* use extractHostTimezone
* remove console log
* pre update
* code improvement
* further fixes
* cleanup
* -_-
* chore: DI available slots service repositories
* remove configService from worker module
* register scheduleRepo in availableSlotsModule
* chore: bump platform libs
* remove useless comment from prisma module
* fix: availableSlotsModule to class deps
* fix: repositoriesModule deps
* chore: container pattern
* refactor: move modules in DI folder
* fixup! refactor: move modules in DI folder
* refactor: GetAvailableSlotsService
* chore: add todo comments where DI is needed
* chore: bump platform libs
* chore: fix unit tests
* fix: only instantiate AvailableSlotsService once per service
* Update packages/trpc/server/routers/viewer/slots/util.ts
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* fix: bind this on all functions with reporting
---------
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* migration plus feature flag
* show navigation route + inital roles migration
* add a check permission use case to take in the feature flags for a team
* bulk update script
* inital frontend work for displaying roles
* move to a more "anemic domain models" approach
* update test to match new DDD strutcture
* fix tests
* update transaction call back types to include trx
* align fe types after transaction to DDD
* move away from usecases to a more domain tailored approach
* get permissions per resource and map them to domain permission string
* update permision logic
* correctly get the logic for *.* permissions on owner
* wip sheet logic for ssr
* role list
* use nuqs for sheet parsing on handle change
* fox
* improve hook usage
* enable PBAC router
* delete modal etc
* i18n and inital rough layout of roles + permisions creating
* add color to migrations
* add colors and new method to tests
* move hooks out of infra into client with provider
* move hooks out of infra into client with provider
* memo features and ensure render once
* remove comment
* seed color
* use role colours
* match i18n
* add custom color picker to edit/create form
* fix advanced mode toggle
* more work on adv permission group
* update migrations
* abstract lots of core form logic to a custom hook
* improve UX for selecting all and toggling all
* improve code quality and use domain mappers in role repositoryu
* call server action to revalidate cache
* call invalidate cache on delete
* fix re-render + improves update logic wip
* fix txn for assinging role to member
* wip on assigning users custom roles
* fix repo
* update logic for checking if users can update roles
* remove member from permission check
* check users permission and assign roles
* move to factory approach
* move default rolesIDs to constant
* add facuted values to table
* display custom role in table
* fix type error
* fix role filter
* check pbac feature flag to see what column to filter on
* push repo mocks and other mocks to fix unit tests
* fix and add test for empty permissions when creating a role
* pass updates to repo so we actually update roles
* fix types
* fix types
* restore lock changes
* fix role service test for new updates section
* fix updated at types
* update mocks to use feature repository mock
* remove roletype from db in model
* prevent multiple queries
* fix typeof in role model
* fix and migrate i18n to one registery
* fix and update i18n to be in registery
* fix type error + fall back in service instead of repo for BL
* more type errors
* update members faceted values to bennys refactor
* fix types
* remove the _resource from type conditionally
* fix managment factory types to expose PBAC enbaled obol
* narrow down types
* wip fix for types
* more fix types
* cast role
* fix tests
* attempt of fixing _resoucre key access type
* attempt of fixing _resoucre key access type
* seperate migraations to batches
* add invalidate time to team features
* restore router to main
* push main lock
* Update packages/features/pbac/domain/types/permission-registry.ts
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* Update packages/features/pbac/domain/mappers/PermissionMapper.ts
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* Update packages/prisma/migrations/20250527091330_add_color_to_pbac_role/migration.sql
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* Update packages/prisma/migrations/20250617070118_update_memberships_one_time/migration.sql
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* Update apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/AdvancedPermissionGroup.tsx
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* fix mapped type
* restore migration
* skip _resource
* use partical
* fix type errors in tests and hooks
* Simplified the role field in the editSchema to use z.nativeEnum(MembershipRole)
* fix type errors for editsheet
* fix type errors for editsheet
* Apply suggestion from comment 2151515295
* remove footer since we dont have docs yet
* add i18n
* lock all toggle chevron
* use prisma
* tidy up old manage permission
* fix i18n
* remove can manage from role permission check
* auto select read
* address benny feedback
* fix type
* fix type
* update function name due to merge
* fix types
* update tests to match new membership method from merge
* address cubic feedback
---------
Co-authored-by: Eunjae Lee <hey@eunjae.dev>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* 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>
* Show distribution option for RR scheduling type
* Add `includeNoShowInRRCalculation` to event type schema
* Add `includeNoShowInRRCalculation` initial event type data
* Add FE option for `includeNoShowInRRCalculation`
* Consider `includeNoShowInRRCalculation` when building `where` clause when getting bookings for RR
* Add `includeNoShowInRRCalculation` param to `getAllBookingsForRoundRobin`
* Add `includeNoShow...` param to `GetLuckyUserParams`
* Pass `includeNoShow...` param to `getBookingsOfInterval` calls
* Add FE option for `includeNoShow...` (actual commit)
* Type fixes
* Fix brackets
* Add booking repository test
* Remove unused method
* Add translation
* Type fix
* Type fix
* Test passing
* Fix tests
* Fix tests
* Fix test
* Type fixes
2025-05-09 16:29:57 +00:00
devin-ai-integration[bot]GitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>keith@cal.com <keith@cal.com>
* Add tests for booking and duration limits in getSchedule.test.ts
Co-Authored-By: keith@cal.com <keith@cal.com>
* fix: use SchedulingType enum instead of string for schedulingType
Co-Authored-By: keith@cal.com <keith@cal.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: keith@cal.com <keith@cal.com>
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
* Add akismet package to tasker
* Create scanWorkflowBody task
* Schedule workflow body scan
* Add AKISMET_API_KEY .env
* Auto lock user if spam is detected
* Uncommit key
* Add safe param to workflow step
* Migration for safe field
* Do not process workflow steps is `safe` is false
* Update migration to set previous records to true
* Address comments
* Refactor `scheduleWorkflowNotifications` to accept an object
* If new steps or editing old ones send to tasker
* Call `scheduleWorkflowNotifications` in task
* Fix `IS_SELF_HOSTED`
* Remove unused function
* Make `safe` optional in schema
* Type fix
* Revert "Make `safe` optional in schema"
This reverts commit d0964702affa87c35562300301473d25635c565b.
* Revert "Type fix"
This reverts commit d9a031303269a2994ae46f576ab2a3d31e4d977b.
* Type fixes
* Type fixes
* Address comments
* Fix tests
* Add tests
* Update tests
* Typo fix
* Update `safe` to `verifiedAt`
* feat: Compare workflow reminder bodies to default template (#19060)
* Add `getTemplateForAction` function
* Use `getTemplateForAction` when creating a new step
* Use `getTemplateForAction` when action changes
* Have `emailReminderTemplate` accept an object as a param
* Rename `getTemplateForAction` to `getTemplateBodyForAction`
* Simplify changing body when changing templates
* Create `compareReminderBodyToTemplate`
* In task, compare if reminderBody is a template
* Linting
* Add tests
* refactor: `emailReminderTemplate` to accept object as param (#19288)
* Add `getTemplateForAction` function
* Use `getTemplateForAction` when creating a new step
* Use `getTemplateForAction` when action changes
* Have `emailReminderTemplate` accept an object as a param
* Rename `getTemplateForAction` to `getTemplateBodyForAction`
* Simplify changing body when changing templates
* Create `compareReminderBodyToTemplate`
* In task, compare if reminderBody is a template
* Linting
* Add tests
* Refactor `scheduleEmailReminders`
* Refactor `create.handler` for new workflows
* Refactor `emailReminderManager`
* Refactor `getEmailTemplateText`
* Fix typo
* Type fix - whatsapp plain text template imports
* Type fix - no template found
* Type fix - add `isBrandingDisabled` to `emailReminderTemplate`
* Add workflow and user to prisma mock
* Fix imports for akismet dependencies
* Record user lock reason
* Undo linting changes
* Fix tests
* New workflow, at verify created step
* Handle if `SCANNING_WORKFLOW_STEPS` is toggled
* Move `verifiedAt` checks to specific schedule functions
- `scheduleWhatsappReminder`
- `scheduleEmailReminder`
- `scheduleSMSReminder`
* Update logic
* Do not fallback verifiedAt
* Add comment to next.config.js
* fix trpc session circle dep
* fixes trpc session cirlce dep
* fix relative imports
* fix more imports to use types and not trpc
* fix exports
* Fixed types
---------
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
* feat: implement standard pagination for org member list
* fix type error
* i18n for pagination
* add paginationMode
* apply the change to PlatformManagedUsersTable
* replace useInfiniteQuery with useQuery
* fix type error
* fix type error
* fix type error
* fix type error
* update comment
* remove optimistic update
* minor changes
* update usage on nuqs
---------
Co-authored-by: Benny Joo <sldisek783@gmail.com>
* refactor: Remove intervalLimits from @calcom/lib and export directly
* Tackle other places that use parseBookingLimit/parseDurationLimit
* More type fixups that were hidden by previous fails
* Fixed up booking-limits file
* Remove server-only
* Revert "Revert "chore: rename DWD to DelegationCredential (#19703)" (#19734)"
This reverts commit 340b5ab061.
* chore: fix schema and types for now
* fix: domainWideDelegationCredentialId error type