* refactor: migrate UnconfirmedBookingBadge from features to apps/web
Move UnconfirmedBookingBadge.tsx from packages/features/bookings/ to
apps/web/modules/bookings/components/ as part of the architectural
refactor to remove trpc client imports from the features layer.
Also removes unused preserveBookingsQueryParams function from Navigation.tsx.
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* refactor: move shell navigation and badges to apps/web
Move shell navigation components and trpc-using badges from
packages/features to apps/web/modules to fix circular dependency:
- Move navigation folder to apps/web/modules/shell/navigation/
- Move TeamInviteBadge.tsx to apps/web/modules/shell/
- Create Shell wrapper in apps/web that provides MobileNavigationContainer
- Update all Shell imports in apps/web to use the new wrapper
- Remove MobileNavigationContainer default from features Shell.tsx
- Fix pre-existing lint warnings in touched files
This establishes the pattern for migrating React components that use
trpc hooks from the features layer to the web app layer, ensuring
proper dependency direction: apps/web imports from packages/features,
never the reverse.
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* fix: move SideBar.tsx to apps/web to fix build error
SideBar.tsx was importing Navigation from the moved navigation folder,
causing a build error. Moving SideBar.tsx to apps/web and updating the
features Shell to not have a default SidebarContainer fixes this.
The web Shell wrapper now provides both the default SidebarContainer
and MobileNavigationContainer, maintaining the injection pattern.
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* revert
* revert
* revert
* wip
* wip
* wip
* wip
* wip
* wip
* not used anywhere
* wip
* wip
* wip
* wip
* fix
* fix
* wip
* wip
* wip
* wip
* wip
* fix
* fix
* fix
* fix
* migrate
* migrate admin-adpi
* wip
* feat: migrate organization settings components from packages/features to apps/web/modules
- Migrate profile.tsx, appearance.tsx, general.tsx, privacy.tsx, guest-notifications.tsx, delegationCredential.tsx, other-team-members-view.tsx, other-team-profile-view.tsx
- Migrate attributes directory (AttributesForm.tsx, DeleteAttributeModal.tsx, ListSkeleton.tsx, attributes-create-view.tsx, attributes-edit-view.tsx, attributes-list-view.tsx)
- Migrate admin directory (AdminOrgEditPage.tsx, AdminOrgPage.tsx, WorkspacePlatformPage.tsx)
- Update all page imports to use new paths from ~/settings/organizations/
- Update relative imports in migrated files to use @calcom/features paths
- Fix lint warnings in migrated files
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* fix: update test import path after migration
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* fix: remove unnecessary test-setup import (already in vitest config)
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* wip
* refactor: delete original files after migration to apps/web/modules
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* fix
* fix
* fix
* fix
* wip
* refactor more
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* mv
* update import paths
* wip
* wip
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* mv
* mv
* mv
* fix
* wip
* wip
* fix
* fix
* fix
* fix: make test mocks resilient to vi.resetAllMocks()
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* fix: fix AttributeForm test failures
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* fix
* fix
* refactor: move ee files to apps/web/modules/ee/ folder
- Move teams, workflows, and organizations folders to apps/web/modules/ee/
- Add LICENSE file to apps/web/modules/ee/
- Update all import paths from ~/teams/ to ~/ee/teams/
- Update all import paths from ~/settings/organizations/ to ~/ee/organizations/
- Remove duplicate MemberInvitationModal copy.tsx file
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* fix: move useHasPaidPlan and dependent files to apps/web/modules
- Move useHasPaidPlan.ts from packages/features/billing/hooks to apps/web/modules/billing/hooks
- Move intercom files from packages/features/ee/support to apps/web/modules/ee/support
- Move ContactMenuItem.tsx and dependencies (freshchat, helpscout, zendesk) to apps/web/modules/ee/support
- Move ViewRecordingsDialog.tsx and RecordingListSkeleton to apps/web/modules/ee/video
- Move CalVideoSettings.tsx to apps/web/modules/eventtypes/components/locations
- Move CreateOrEditOutOfOfficeModal.tsx to apps/web/modules/settings/outOfOffice
- Refactor UpgradeTeamsBadge to accept props and create wrapper in apps/web/modules/billing
- Update all callers to use new file locations
- Add eslint-disable comments for pre-existing lint warnings
This fixes the tRPC server build failure caused by circular dependency where
the server build was traversing into packages/features and pulling in React
hooks that depend on @calcom/trpc/react types.
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* fix: correct UpgradeTeamsBadge import path to use package export
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix: pass plan state through SelectProps to UpgradeTeamsBadge
- Add upgradeTeamsBadgeProps field to ExtendedOption type in Select component
- Update OptionComponent to spread upgradeTeamsBadgeProps to UpgradeTeamsBadge
- Update getOptions.ts to accept PlanState object and include upgradeTeamsBadgeProps
- Update WorkflowStepContainer.tsx to pass planState to getWorkflowTriggerOptions/getWorkflowTemplateOptions
- Update WorkflowDetailsPage.tsx to pass upgradeTeamsBadgeProps in transformed action options
- Update AddActionDialog.tsx interface and mapping to include upgradeTeamsBadgeProps
- Add eslint-disable comments for pre-existing React Hook dependency warnings
This fixes the UpgradeTeamsBadge refactoring issue where the badge was always showing
'upgrade' text instead of the correct text based on plan state (trial_mode, inactive_team_plan, etc.)
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* fix: update import paths to use /ee/ folder for workflows and organizations
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* fix: update workflow component imports to use /ee/ folder
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* fix: add missing types.ts for LocationInput.tsx
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* fix: extract BookingRedirectForm type to shared location
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* fix
* wip
* wip
* fix: update BookingRedirectForm import to use local types file
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* wip
* fix
* fix
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* feat: store ads clickid when creating an account
* fix: type check
* fix: google campaignId not being added to stripe
* remove tracking in stripe app
* add webhook version schema
* version the code
* update version from numeric to date val
* migration
* update schema and build factory
* update string
* move version picker
* tooltip instead of infobadge
* --
* fix type
* --
* fix type
* fix type
* --
* fix messed up merge
* improvements to payloadfactory
* extract version off of DB and instead keep it in IWebhookRepository
* fix webhookform
* fix type safety and routing ambiguity
* scalable with easier factory extensions and base definition
* fix types
* --
* --
* clean up prisma/client type imports
* fix
* type fix
* type fix
* cleanup
* add tests and registry changes
* unintended file inclusion
* type-fix
* select in repo
* --
* explicit return type
* --
* fix type
* fixes
* feedback 1
* feedback 2
* use enum instead of string
* fixes
* use booking.uid instead of booking.id for url param
* show timezone on calendar
* fix type
* restore horizontal tab and remove header and subtitle
* clean up sidebar items
* fix event propagation from attendees
* fetch all statuses except for cancelled on calendar view
* clean up styles of the badges on BookingListItem
* fix useMediaQuery
* add close button to the header
* add assignment reason to the details sheet
* use separator row
* use ToggleGroup for the top bookings tab
* move ViewToggleButton
* resize the action button
* remove wrong prop
* fix type error
* fix type error
* hide view toggle button on mobile (and fix the breakpoint)
* remove unused e2e tests
* fix e2e tests
* hide toggle button when feature flag is off
* update skeleton
* improve attendees on booking list item and slide over
* improve attendee dropdown
* fix type error
* move query to containers
* select attendee email
* infinite fetching for calendar view
* update styles
* fix compatibility
* fix: add backward compatibility for status field in getAllUserBookings
* increase calendar height
* fix type error
* support Member filter only for admin / owners
* add debug log (TEMP)
* add event border color
* show Reject / Accept buttons on BookingDetailsSheet
* move description section to the top
* update When section
* update style of Who section
* add CancelBookingDialog WIP
* fix CancelBookingDialog
* increase clickable area
* add schedule info section WIP
* fix flaky reject button
* fixing reschedule info WIP
* add fromReschedule index to Booking
* improve rescheduled information
* improve reassignment
* fix type error
* fix unit test
* respect user's weekStart value on the booking calendar view
* update debug log
* improve payment section
* clean up
* fix log message
* reposition filters on list view
* fix bookings controller api2 e2e test
* clean up file by extracting logic into custom hooks
* rename files
* merge BookingCalendar into its container
* extract logic into separate hook files
* remove redundant logic
* rearrange items on calendar view
* add WeekPicker
* extract filter button
* responsive header on list view
* horizontal scroll for ToggleGroup WIP
* fix type error
* fix cancelling recurring event
* address feedback
* fix e2e tests
* fix unit test
* fix e2e tests
* make hover style more visible for ToggleGroup
* fix margin on CancelBookingDialog
* update styles on the slide over (mostly font weight)
* update style of CancelBookingDialog
* update styles
* update margin top for the header
* refactor getBookingDetails handler
* fix gap in who section
* auto-filter the current user on the calendar view
* calculate calendar height considering top banners
* improve booking details sheet interaction without overlay
* update calendar event styles
* update reject dialog style
* put uid first in the query params
* fix class name
* memoize functions in useMediaQuery
* query attendee with id instead of email
* update margins
* replace TRPCError with ErrorWithCode
* move calculation outside loop
* remove dead code
* Add /router to isBookingPages
* Remove Dynamic Posthog Provider from AppProvider.tsx because that is only used by the pages router, and the pages router is only in use by the /router endpoint, which is a booking page and we havent implemented corresponding GeoProvider support for it
* fix: prevent bulk update of locked locations in child managed event types
- Filter out child managed event types with locked locations in getBulkUserEventTypes
- Add validation in bulkUpdateEventsToDefaultLocation to prevent updating locked fields
- Implements defense in depth with validation at multiple layers
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* Abstract filtering logic
* test: add comprehensive tests for bulk location update filtering
- Add unit tests for filterEventTypesWhereLocationUpdateIsAllowed
- Add unit tests for bulkUpdateEventsToDefaultLocation
- Add integration tests for getBulkUserEventTypes
- Fix bug: change unlockedFields?.locations check from !== undefined to === true
This ensures that locations: false is properly treated as locked, addressing
the security issue identified in PR review comments
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* fix: filter locked managed event types on app installation page
- Add parentId to eventTypeSelect in getEventTypes function
- Apply filterEventTypesWhereLocationUpdateIsAllowed to both team and user event types
- Only filter when isConferencing is true to avoid affecting other app types
- Fixes issue where locked managed event types were showing in the event type selection list on /apps/installation/event-types page
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* fix(embed-react): remove obsolete availabilityLoaded event listener
The availabilityLoaded event does not exist in the EventDataMap type system
in embed-core. This code was causing 5 TypeScript errors in CI:
- Type 'availabilityLoaded' does not satisfy constraint 'keyof EventDataMap'
- 'data' is of type 'unknown' (2 occurrences)
- Type 'availabilityLoaded' is not assignable to action union (2 occurrences)
Since this is an example file and the event is not defined in the type system,
removing this obsolete code resolves the type errors.
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* fix: correct Prisma type for metadata in test helper function
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* fix: use flexible PrismaLike type for better test compatibility
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* fix: properly type mock Prisma objects in test files
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* fix: properly mock Prisma methods in test file
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* Filter out metadata
* Undo change in embed file
* Address feedback
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-11-19 15:46:05 -05:00
Joe Au-YeungGitHubcubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>Syed Ali Shahbaz
* Move TeamBillingRepositories
* WIP refactor team internal billing service
* Remove duplicate billing repository files
* Remove logic check in repository for billing is enabled
* Rename repository to `TeamBillingData`
* Use repository factory in main service
* Fix new import paths
* Rename to
* Ensure `IS_TEAM_BILLING_ENABLED` is of type boolean
* Rename classes to TeamBillingService and TeamBillingServiceFactory
* Implement DI in `BookingServiceFactory`
* `TeamBillingService` use repository in `getOrgIfNeeded`
* DI `isTeamBillingEnabled` to `TeamBillingServiceFactory`
* Rename files for consistency
* Return stub BillingRepository if billing is not enabled
* Move Stripe billing service to service folder
* Rename file
* `StripeBillingService.getSubscriptionStatus` return `SubscriptionStatus`
* Type fices in StripeBillingService
* Type fix in `stubTeamBillingService`
* DI the `BillingProviderService` into the `TeamBillingService`
* Implement DI in `skipTeamTrials.handler`
* Implement DI for team billing in `inviteMember.handler`
* `skipTeamTrials.handler` use `team.isOrganization`
* Implement DI for billing in `hasActiveTeamPlan.handler`
* Type fixes
* Implement DI in `bulkDeleteUsers.handler`
* Implement `BillingProviderServiceFactory` in `updateProfile.handler`
* Implment `BillingProviderServiceFactory` in `buyCredits.handler`
* Fix import in `stripeCustomer.handler`
* Add a constructor to `teamBillingServiceFactory`
* Add DI to `PrismaTeamBillingRepository`
* Add DI to `StripeBillingService`
* Implement singleton in `BillingProviderServiceFactory`
* Add DI folder and contents to billing folder
* Use `getTeamBillingServiceFactory` in `inviteMember.handler`
* Add `saveTeamBilling` method to `ITeamBillingService`
* Implement DI in new team route
* Implement DI in `teamService`
* Implement DI in `OrganizationPaymentService`
* Implement DI in `credit-service`
* In `StripeBillingService` remove `static` from status methods
* Implemnt DI in `_invoice.paid.org`
* Refactor `hasActiveTeamPlan` to use `getTeamBillingFactory`
* Refactor `skipTeamTrials` to use `getTeamBillingFactory`
* Refactor `skipTeamTrials` to use `getTeamBillingServiceFactory`
* `stripeCustomer.handler` to use `getBillingProviderService`
* Remove old factories
* Type fix
* Remove unused factory
* Refactor `updateProfile.handler` to use `getBillingProviderService`
* Change name to `TeamBillingDataRepositoryFactory`
* Type Prisma return in `prisma.module`
* Type fix
* Refactor `buyCredits.handler` to use `getBillingProviderService`
* Refactor `credit-service` to use billing DI containers
* Type fix
* Add `getTeamBillingDataRepository`
* Refactor `_invoice.paid.org` to use DI container
* Refactor `_customer.subscription.deleted.team-plan` to use DI container
* Refactor `calcomHandler` to use DI container
* Refactor `getCustomerAndCheckoutSession` to use DI container
* Refactor `verify-email` to use DI containers
* Refactor `api/create/route` to use DI container
* Refactor downgradeUsers to use DI container
* Type fix
* Clean up console.logs
* Add await to `this.billingRepository.create` in `saveTeamBilling`
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* Fix type errors
* Address comments
* fix: update tests to work with new DI pattern
- Update teamBillingService.test.ts to properly inject DI dependencies
- Remove unused billingModule import and mock
- Fix import naming in teamService.integration-test.ts (remove unused rename)
- Fix import path for TeamBillingPublishResponseStatus
All tests now properly mock IBillingProviderService, ITeamBillingDataRepository,
and IBillingRepository instead of using the old BillingRepositoryFactory pattern.
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* fix: add compatibility layer and env setup for unit tests
- Add STRIPE_PRIVATE_KEY dummy value to vitest.config.ts to prevent DI module errors
- Fix import paths in credit-service.test.ts (StripeBillingService, TeamBillingService)
- Create compatibility barrel at packages/features/ee/billing/teams/index.ts for test mocking
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* fix: update unit tests to mock DI container properly
- Update teamService.test.ts to mock getTeamBillingServiceFactory() instead of TeamBilling.findAndInit
- Update teamService.alternative.test.ts to mock DI container
- Update credit-service.test.ts to mock getBillingProviderService() and use SubscriptionStatus enum values
- Update OrganizationPaymentService.test.ts to mock DI container instead of direct StripeBillingService import
- Remove all 'as any' type casting to comply with Cal.com coding standards
- Fix unused variable warnings by prefixing with underscore
All 53 tests now passing (16 + 1 + 30 + 6)
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* fix: update remaining unit tests to use DI pattern
- Fix StripeBillingService.test.ts to inject mock Stripe client directly
- Fix teamBillingFactory.test.ts to mock getTeamBillingServiceFactory() from DI container
- Fix skipTeamTrials.test.ts to mock DI container and use SubscriptionStatus enum
All 11 previously failing tests now pass (5 + 5 + 1)
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* Undo changes made to Prisma module
* fix: address test-related PR comments
- Fix OrganizationPaymentService.test.ts mock path from @calcom/ee to @calcom/features/ee
- Refactor teamBillingFactory.test.ts to test real factory logic instead of mocking container
- Remove duplicate teamBillingService.test..ts file with incorrect double-dot filename
All three test files now pass successfully with proper DI patterns.
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* Address feedback
* fix: update teamService integration test to mock new DI factory pattern
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* refactor: remove duplicate imports in credit-service.test.ts
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* Remove unused index file
* `getBySubscriptionId` to return team or null
* Address feedback
* Merge fix
* Refactor file names
* fix: correct mockStripe variable name to stripeMock in StripeBillingService.test.ts
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* refactor: update internal-team-billing.test.ts to use new DI structure with TeamBillingService
- Replace InternalTeamBilling with TeamBillingService
- Use constructor injection with mock dependencies instead of factory pattern
- Remove BillingRepositoryFactory mock and import
- Update all test cases to use mockBillingProviderService, mockTeamBillingDataRepository, and mockBillingRepository
- Simplify saveTeamBilling tests to focus on repository.create calls
- All 11 tests now pass with the new DI structure
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* fix: update createWithPaymentIntent.handler.test.ts to mock DI container's getBillingProviderService
- OrganizationPaymentService now uses getBillingProviderService() from DI container
- Test was mocking @calcom/features/ee/payments/server/stripe directly, which no longer works
- Added mock for @calcom/features/ee/billing/di/containers/Billing module
- Mock returns fake billing provider that delegates to mockSharedStripe
- Preserves all existing test assertions and helpers
- Fixed lint error by prefixing unused lastCreatedSessionId with underscore
- All 11 tests now pass (1 skipped as expected)
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
---------
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com>
* Remove auto adding users to an org
* Update tests
* Fix tests
* fix: Update organization invitation E2E tests to not expect auto-accept before signup
- Changed isMemberShipAccepted expectations from true to false before signup
- Users with emails matching orgAutoAcceptEmail are no longer auto-accepted
- They must explicitly accept the invitation after signup
- Fixed lint warnings for unused parameters
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* fix: Update E2E tests to expect pending membership after signup without auto-accept
Since auto-accept functionality was removed, users with emails matching
orgAutoAcceptEmail are no longer automatically accepted into organizations
after signup. They remain in pending state until explicitly accepted.
Updated assertions in:
- 'nonexisting user is invited to Org' test
- 'nonexisting user is invited to a team inside organization' test
Both tests now correctly expect isMemberShipAccepted: false after signup.
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* Restore `verify-email` and tests from `main`
* Add `orgAutoJoinOnSignup` to `organizationSettings`
* Update
`OrganizationRepository.findUniqueNonPlatformOrgsByMatchingAutoAcceptEmail`
to find orgs where `orgAutoJoinOnSignup` is true
* `organization.update` lint fix
* `organization.update` to handle `orgAutoJoinOnSignup`
* Create toggle for `orgAutoJoinOnSignup`
* test: Add comprehensive tests for orgAutoJoinOnSignup functionality
- Update existing test to expect null instead of error when multiple orgs match
- Add test for when orgAutoJoinOnSignup is false (should return null)
- Add test for when orgAutoJoinOnSignup is true (should return org)
- Add test for default behavior (orgAutoJoinOnSignup defaults to true)
These tests verify that the new orgAutoJoinOnSignup setting correctly controls
whether users are automatically added to organizations during email verification.
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* Type fix
* e2e: invited users should be accepted after signup (address cubic r2511916791)
Reverted post-signup isMemberShipAccepted assertions from false to true for
explicit invite scenarios. When users are explicitly invited to an org/team
and complete signup via invite link, their membership should be accepted.
This is distinct from auto-join by domain (controlled by orgAutoJoinOnSignup),
which only affects users who sign up without an invite but match the org's
email domain.
Backend sets membership.accepted = true on invite completion in:
packages/features/auth/signup/utils/createOrUpdateMemberships.ts:61,67,77,83
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* Fix API V2 build
---------
Co-authored-by: Alex van Andel <me@alexvanandel.com>
Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* bookings page redesign work in progress
fix: duplicate translation key
chore: use newly supported separator type
remove outdated BookingDetailsSheet
remove dropdown and related code
revert unncessary changes
* fix wrong rebase
* fix type error
* refactor: separate bookings columns into filter and display columns (#24959)
* refactor: separate bookings columns into filter and display columns
- Extract filter-only columns into shared filterColumns.ts
- Extract list display columns into listColumns.tsx
- Create BookingsListContainer for list view with both column sets
- Create BookingsCalendarContainer for calendar view with filter columns only
- Refactor bookings-view.tsx to use dynamic imports for containers
- Remove column/table creation logic from bookings-view.tsx
This ensures calendar view doesn't import list-specific UI components (AvatarGroup, Badge, etc.)
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* fix: return null instead of false for separator rows in filter accessors
The filter accessor functions were returning false for separator rows instead of null,
which would pollute the multi-select filters with bogus 'false' values.
This fix ensures that separator rows return null so they are properly excluded from filters.
Addresses cubic AI reviewer feedback on PR #24959
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* clean up filter column visibility
* feat: integrate booking calendar view with re-designed list (#24973)
* add toggle button
* remove the dateRange filter when switching from calendar to list view
* move "view" to the action dropdown
* add close button the details sheet
* move close button
* fix more button behavior
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix type error
* update the test case
* fix e2e util
* fix actions dropdown
* revert e2e tests
* fix type error on BookingActionsDropdown.tsx
* fix: include today's bookings in flatData for past status
Previously, flatData excluded groupedBookings.today, which caused
past bookings that happened today to not show up when status === 'past'.
This fix includes today's bookings in flatData for all statuses.
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* improve attendee cell
* fix e2e tests
* change max
* fix e2e
* add reschedule requested message
* fix e2e
* update e2e
* remove flaky checks
---------
Co-authored-by: Eunjae Lee <hey@eunjae.dev>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* chore: Rate limit top level of public booking pages
* Prefix rateLimit keys
* Adding more rate limits
---------
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
* fix: APIV2 team membership addition
* feat: Add trimming for email domain and orgAutoAcceptEmail in auto-accept logic
- Trim whitespace from both user email domain and orgAutoAcceptEmail
- Ensures consistent matching even with accidental whitespace
- Addresses feedback from PR review
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* simplify
* feat: Use shared OrganizationMembershipService in TRPC for consistent auto-accept logic
- Create OrganizationMembershipService.container.ts for DI in TRPC
- Update getOrgConnectionInfo to apply trimming + case-insensitive comparison
- Precompute auto-accept decisions in createNewUsersConnectToOrgIfExists using the service
- Use service in handleNewUsersInvites for consistent auto-accept determination
- Ensures both API v2 and TRPC paths use identical trimming and normalization logic
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* Revert "feat: Use shared OrganizationMembershipService in TRPC for consistent auto-accept logic"
This reverts commit 0b2bd28b6e32e8c1d3dea139ca8ff9cbf402ac00.
* refactor: Unify OrganizationRepository and remove duplicate PrismaOrganizationRepository (#24869)
* refactor: Convert OrganizationRepository from static to instance methods
- Add constructor accepting deps object with prismaClient
- Convert all static methods to instance methods
- Add getOrganizationAutoAcceptSettings method
- Create singleton instance export in repository barrel file
- Update API v2 OrganizationsRepository to extend from OrganizationRepository
- Update all call sites to use singleton instance
- Add platform-libraries organizations.ts export
- Fix mock imports to use repository barrel
- Fix unsafe optional chaining in next-auth-options.ts
- Fix any types in test files with proper type inference
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* fix: Update all imports to use OrganizationRepository barrel export
- Update imports from direct OrganizationRepository file to barrel export
- This ensures mocks work correctly in tests
- Fixes 202 failing tests related to organizationRepository mock
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* fix: Update test mocks to use partial mock pattern
- Convert organizationMock to partial mock that preserves real class
- Add proper prisma mocks to failing test files
- Remove old OrganizationRepository mocks from test files
- This fixes test failures related to mock interception
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* fix: Export mocked singleton and update tests to use it directly
- Export mockedSingleton as organizationRepositoryMock from organizationMock
- Update delegationCredential.test.ts to import and use the exported mock
- This fixes 'vi.mocked(...).mockResolvedValue is not a function' errors
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* fix: Use platform-libraries import for API v2 OrganizationRepository
API v2 should import shared features through @calcom/platform-libraries
instead of directly from @calcom/features to maintain proper architectural
boundaries and packaging/licensing separation.
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* refactor: Implement DI pattern for OrganizationRepository
- Create OrganizationRepository.module.ts and .container.ts for DI
- Replace singleton pattern with getOrganizationRepository() across 20 files
- Update platform-libraries to export getOrganizationRepository
- Delete duplicate PrismaOrganizationRepository.ts
- Remove singleton export file (repositories/index.ts)
- Update test mocks to use DI container pattern
- All type checks and unit tests passing
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* fix: Implement read/write client separation in OrganizationRepository
- Updated OrganizationRepository constructor to accept optional prismaWriteClient parameter
- Routed all write operations (create, update) through prismaWrite client
- Routed all read operations (find, get) through prismaRead client
- Updated API v2 OrganizationsRepository to pass both dbRead.prisma and dbWrite.prisma to super()
- Optimized getOrganizationRepository() calls by storing in local variables to avoid repeated function calls
- This fixes the critical issue where API v2 was passing read-only client to base class with write methods
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* fix: Fix mock setup and optimize getOrganizationRepository() calls
- Fixed verify-email.test.ts mock to return mocked repository instance instead of scenario helper object
- Added mockReset to organizationMock.ts beforeEach to properly reset mock implementations between tests
- Added local variables in page.tsx to store getOrganizationRepository() result for consistency
This fixes the issue where getOrganizationRepository() was returning organizationScenarios.organizationRepository (scenario helper) instead of the actual mocked repository instance, causing findUniqueNonPlatformOrgsByMatchingAutoAcceptEmail to be undefined.
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* refactor: Simplify OrganizationRepository to use single prismaClient
- Updated base OrganizationRepository constructor to accept only { prismaClient } instead of { prismaClient, prismaWriteClient? }
- Replaced this.prismaRead and this.prismaWrite with single this.prismaClient property
- Updated API v2 OrganizationsRepository to pass only dbWrite.prisma as prismaClient
- Removed unused PrismaReadService import from API v2
- All read and write operations now use the same client instance
This simplifies the architecture as requested - API v2 uses write client for all operations, and apps/web uses the client from DI container.
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: Match OrganizationsRepository.findById signature with base class
The findById method in OrganizationsRepository was using a different signature
than the base OrganizationRepository class, causing type errors in CI.
Changed from: findById(organizationId: number)
Changed to: findById({ id }: { id: number })
This matches the base class signature and resolves the CI unit test failures.
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* fix: Update all findById call sites to use object parameter
Fixed 6 call sites in API v2 that were calling findById with a number
instead of the required { id: number } object parameter:
- is-org.guard.ts
- is-admin-api-enabled.guard.ts
- is-webhook-in-org.guard.ts
- organizations.service.ts
- managed-organizations.service.ts (2 call sites)
This resolves the API v2 build failure caused by the signature change
in OrganizationsRepository.findById to match the base class.
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* fix: Remove redundant findById override from OrganizationsRepository
The findById method was duplicating the base class OrganizationRepository
implementation. Both methods had identical logic (filtering by isOrganization: true),
so the override was unnecessary.
Since OrganizationsRepository extends OrganizationRepository and passes
dbWrite.prisma to the base constructor, the base class method already
provides the exact same functionality.
This resolves the API v2 build failure by eliminating the duplicate method
that was causing conflicts.
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* Remove unncessary changes
* Store in variable
* Revert "Remove unncessary changes"
This reverts commit af9351786a21616c9508c441191c17f2374fb2cc.
* Revert dbRead/dbWrite changes
* Add organizations library to tsconfig.json
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
* i18n
* WIP icon stuff
* More icon work
* More gradient tuning
* Mvoe plan-icon to planicon.tsx
* Fix cubic suggestion
* Fix darkmode icon and gradients
* Fix type error
* Onboarding path service
* Update usages of onboarding path and getting started hook
* feat: redirect to new onboarding flow
* Getting started
* Brand details
* Preview organization brands
* Orgs team pages
* Invite team steps
* Move to global zustand store
* Few darkmdoe fixes
* Wip onboarding + stripe flow
* Default plan state
Server Action for gettting slug satus of org
* Remove onboardingId
* Confirmation prompt
* Update old onboarding flow handlers to handle new fields
* update onboarding hook
* Filter out organization section for none -company emails
* Match placeholders to users domain
* Drop migration
* Wip new onboarding intent
* WIP flow for self-hosted. Same service call just split logic
* WIP
* Add TODO
* Use onboarding user type instead of trpc session
* WIP
* WIP
* pass role and team name from onboarding to save in schema
* Add test to ensure role + name + team are persisted into onboarding table
* migrate roles to enum values
* Update ENUM
* Fix type error
* Redirect if flag is disabled
* Revert packages
* Revert all packages/* changes to original branch point
* Layout fixes + design
* Add slugify
* Support saving brand,logo and banner
* Cleanup
* iMobile fixes
* More mobile and darkmdoe fixes
* Add I18n
* Fix lock file
* Fix types
* Fix types errors
* Copy changes
2025-10-23 20:01:54 +01:00
Eunjae LeeGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* chore: Move post booking stuff to separate service
* refactor: improve ISP compliance in BookingEventHandlerService
- Refactor updatePrivateLinkUsage to only accept hashedLink parameter instead of full payload
- Remove shouldProcess function and inline isDryRun check for better clarity
- Addresses feedback from PR #24025
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* define only what is used
* Define hashed-link-service as well in api-v2
* fix: export HashedLinkService through platform-libraries
- Add HashedLinkService to platform-libraries/private-links.ts
- Update API V2 to import from platform library instead of direct path
- Fixes MODULE_NOT_FOUND error in API V2 build
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
2025-10-23 15:05:55 +03:00
Keith WilliamsGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>cal.comMorgancubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* feat: upgrade Prisma to 6.16.0 with no-rust engine
- Update Prisma packages to 6.16.0
- Add PostgreSQL adapter dependency
- Configure engineType: 'client' and provider: 'prisma-client' in schema
- Update Prisma client instantiation with PostgreSQL adapter
- Remove binaryTargets from generators (not needed with library engine)
- Fix schema view issue by removing @id decorator from BookingTimeStatusDenormalized
- Fix ESLint warning by removing non-null assertion
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* Web app running but types wrecked
* web app running but build and type issues
* Removed the connection pool
* Fixed zod type issue
* Fixed types in booking reference extension
* Fixed test issues
* Type checks passing it seems
* Using cjs as moduleFormat
* Fixing Prisma undefined
* fix: update prismock initialization for Prisma 6.16 compatibility
- Add @prisma/internals dependency for getDMMF()
- Restructure prismock initialization to use createPrismock() with DMMF
- Create Proxy that's returned from mock factory for proper spy support
- Fixes 89 failing unit tests with 'Cannot read properties of undefined (reading datamodel)' error
- Based on workaround from prismock issue #1482
All unit tests now pass (375 test files, 3323 tests passed)
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: cast serviceAccountKey to Prisma.InputJsonValue in bookingScenario.ts
- Apply type cast at lines 2493 and 2535
- Fixes type errors from Prisma 6.16 upgrade
- Follows established pattern from delegationCredential.ts
- Add eslint-disable for pre-existing any types
- Rename unused appStoreLookupKey parameter to satisfy lint
- All 3323 tests passing
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* chore: remove whitespace-only lines from bookingScenario.ts
- Remove blank lines where eslint-disable comments were replaced
- Cleanup from pre-commit hook formatting
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* Update is-prisma-available-check.ts
* fix: remove datasources config when using Prisma Driver Adapters
- Update customPrisma to create new adapter when datasources URL is provided
- Remove datasources config from API v2 Prisma services (already in adapter)
- Fixes 'Custom datasource configuration is not compatible with Prisma Driver Adapters' error
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: use Pool instances for PrismaPg adapters in index.ts
- Create Pool instance before passing to PrismaPg adapter
- Update customPrisma to create Pool for custom connection strings
- Matches working pattern from API v2 services
- Fixes 'Invalid `prisma.$queryRawUnsafe()` invocation' error
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* Not using queryRawUnsafe
* Trying anything at this point
* Make sure the DB is ready first
* Don't auto run migrations in CI mode
* Revert "Make sure the DB is ready first"
This reverts commit 2b20bd45c974f3d7e07d8b904bc7fcdae37cce03.
* Dynamic import of prisma
* Commenting where it seems to break
* Backwards compatability for API v2
* fix: add explicit type annotations for map callbacks in API v2
- Add type annotation for map parameter in memberships.repository.ts
- Add type annotation for map parameter in stripe.service.ts
- Fixes implicit 'any' type errors from stricter Prisma 6.16.0 type inference
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: add explicit type annotations for API v2 map callbacks
- users.repository.ts:292: add Profile & { user: User } type
- memberships.service.ts:19-20: add Membership type to filter callbacks
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: add explicit type annotation for attributeToUser in organizations-users.repository.ts
- organizations-users.repository.ts:63: add AttributeToUser with nested relations type
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: add explicit Membership type annotations in teams.repository.ts
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: use API v2 dedicated Prisma client to support adapter in PrismaClientOptions
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* Running API v2 build commands together so they all get the space size var
* Fixing Maximum call depth exceeded error
* fixed type issues
* Trying to make the seed more stable
* Revert "Trying to make the seed more stable"
This reverts commit 1fd4495e6af7acd7981cda7dedec3168979b0e9d.
* Fixed path to prisma client
* Fixed type check
* Fix eslint warnings
* fix: externalize @prisma/adapter-pg and pg in platform-libraries Vite config
- Add @prisma/adapter-pg and pg to external dependencies list
- Add corresponding globals for these packages
- Fix Prisma client aliases to point to packages/prisma/client instead of node_modules
- Add Node.js resolve conditions to prefer Node.js exports
- Keep commonjsOptions.include for proper CommonJS transformation
- Add eslint-disable for __dirname in Vite config file
- Remove problematic prettier/prettier eslint comment
This fixes the 'Extensions.defineExtension is unable to run in this browser environment' error when running yarn generate-swagger in apps/api/v2 after upgrading to Prisma v6.16 with the no-rust engine approach.
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: update Prisma imports in API v2 services to use package path
- Change imports from '../../../generated/prisma/client' to '@calcom/prisma/client'
- Fixes CI error: Cannot find module '../../../../../packages/prisma/generated/prisma/client.ts'
- Aligns with backwards compatibility re-export structure after Prisma v6.16 upgrade
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: remove .ts extension from Prisma client path mapping in tsconfig
- Remove file extension from @calcom/prisma/client path mapping
- Fixes runtime error: Cannot find module '../../../../../packages/prisma/generated/prisma/client.ts'
- TypeScript path mappings should not include file extensions per best practices
- Allows Node.js to correctly resolve to .js files at runtime
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: resolve Prisma 6.16.0 type incompatibilities in bookingScenario tests
- Changed InputPayment.data type from PaymentData to Prisma.InputJsonValue
- Changed createCredentials key parameter from JsonValue to InputJsonValue
- Removed unused PaymentData type definition
- Resolves type errors at lines 709 and 1088 without using 'as any' casts
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: remove non-existent Watchlist fields from test fixtures
- Remove createdById from isLockedOrBlocked.test.ts (lines 15, 20)
- Remove severity and createdById from _post.test.ts (line 110)
- These fields don't exist in Watchlist model schema after Prisma 6.16.0 upgrade
- Resolves TS2353 errors without using 'as any' casts
Relates to PR #23816
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: api v2 imports generated prisma and platform libraries
* fix: resolve type errors from Prisma 6.16 upgrade
- Add missing markdownToSafeHTML import in AppCard.tsx
- Fix organizationId null handling in fresh-booking.test.ts
- Remove non-existent createdById field from Watchlist test utils
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* Put back some external rollups
* Added back the resolve conditions
* Stop using Pool directly
* chore: remove prisma bookingReferenceExtension and update calls
* fix: organizations-admin-not-team-member-event-types.e2e-spec.ts
* chore: bring back POOL in api v2 prisma clients
* chore: remove Pool but await connect
* fixup! chore: remove Pool but await connect
* chore: bring back Pool on all clients
* chore: end pool manually
* chore: test with pool max 1
* chore: e2e test prisma max pool of 1 connection
* chore: give more control over pool for prisma module with env
* remove pool from base prisma client
* chore: prisma client in libraries use pool
* Fixed types
* chore: log pool events and improve pooling
* Fixing some types and tests
* Changing the parsing of USE_POOL
* fix: ensure Prisma client is connected before seeding to prevent transaction errors
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* chore: adjust pools
* chore: add process.env.USE_POOL to libraries vite config
* fix: v1 _patch reference check bookingRef on the booking find
* fix: v1 get references deleted null for system admin
* test: add integration tests for bookingReference soft-delete behavior
- Add bookingReference.integration-test.ts to test repository methods
- Add handleDeleteCredential.integration-test.ts to test credential deletion cascade
- Add booking-references.integration-test.ts for API v1 integration tests
- All tests verify soft-delete behavior without using mocks
- Tests use real database operations to ensure soft-deleted records persist
- Cover scenarios: replacing references, credential deletion, querying with filters
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* refactor: convert booking-references test to actual API endpoint testing
- Modified _get.ts to export handler function for testing
- Refactored integration test to call API handler instead of directly testing Prisma
- Added timestamps to test data to avoid conflicts
- Tests now verify API layer correctly filters soft-deleted references
- All 4 tests passing
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: add explicit prisma.$connect() call to seed-insights script
With Prisma 6.16 and the PostgreSQL adapter, scripts need to explicitly call $connect() before running database operations to ensure the connection pool is properly initialized. This prevents 'Transaction already closed' errors.
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: add $connect() to main() execution in seed-insights
Both main() and createPerformanceData() entry points need explicit prisma.$connect() calls with the Prisma 6.16 PostgreSQL adapter.
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: always use connection pool for Prisma PostgreSQL adapter
Enable connection pooling by default for the Prisma adapter to prevent
transaction state issues during seed operations. Without a pool, each
operation creates a new connection which can lead to 'Transaction already
closed' errors during heavy database operations like seeding.
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* Revert "fix: always use connection pool for Prisma PostgreSQL adapter"
This reverts commit 6724bb08e42bc0a94846069de83b04db0aeb8e8b.
* fix: enable connection pool for db-seed in cache-db action
Set USE_POOL=true when running yarn db-seed to use connection pooling
with the Prisma PostgreSQL adapter. This prevents 'Transaction already
closed' errors during seeding by maintaining stable database connections.
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: add safety check for undefined ownerForEvent in seed script
Prevent 'Cannot read properties of undefined' error when orgMembersInDBWithProfileId
is empty. This can happen if organization members fail to create or when there's a
duplicate constraint violation causing early return.
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: v1 _patch reference check bookingRef
* fix: increase pool size and add timeout settings to prevent transaction errors
- Increase max connections from 5 to 10
- Add connectionTimeoutMillis: 30000 (30 seconds)
- Add statement_timeout: 60000 (60 seconds)
These settings help prevent 'Unknown transaction status' errors during
heavy database operations like seeding by giving transactions more time
to complete and allowing more concurrent connections.
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* Revert "fix: increase pool size and add timeout settings to prevent transaction errors"
This reverts commit 148264f1f1861dfb09a082937a3e2b49e78fc41a.
* fix: remove standalone execution in seed-app-store to prevent premature disconnect
The seed-app-store.ts file had a standalone main() call at the bottom
that would execute immediately when imported, including a prisma.$disconnect()
in its .finally() block.
This caused issues because:
1. seed.ts imports and calls mainAppStore()
2. The import triggers the standalone main() execution
3. This standalone execution disconnects prisma after completion
4. seed.ts then tries to call mainHugeEventTypesSeed() but prisma is disconnected
5. This leads to 'Unknown transaction status' errors
Fixed by removing the standalone execution since mainAppStore() is already
called programmatically from seed.ts which manages the connection lifecycle.
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: use require.main check to prevent premature disconnect when imported
Added require.main === module check so seed-app-store.ts:
- Runs standalone with proper connection management when executed directly
via 'yarn seed-app-store' or 'ts-node seed-app-store.ts'
- Does NOT run standalone when imported as a module by seed.ts,
preventing premature prisma disconnect
This fixes 'Unknown transaction status' errors while maintaining
backward compatibility for direct execution.
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: seed apps before creating users to prevent foreign key constraint violation
Reordered seeding operations to call mainAppStore() before main() because:
- main() creates users with credentials that reference apps via appId foreign key
- mainAppStore() seeds the App table with app records
- Apps must exist before credentials can reference them
This fixes the 'Foreign key constraint violated on Credential_appId_fkey' error
that occurred when creating credentials before the apps they reference existed.
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* Apply suggestion from @cubic-dev-ai[bot]
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* Removing functional changes of deleted: null
* Apply suggestion from @keithwillcode
* refactor: move seedAppData call to bottom of main() in seed.ts
Moved seedAppData() call from seed-app-store.ts to the bottom of main()
in seed.ts to ensure the 'pro' user is created before attempting to
create routing form data for them.
Changes:
- Exported seedAppData function from seed-app-store.ts
- Removed seedAppData() call from the main() export in seed-app-store.ts
- Added seedAppData() call at the bottom of main() in seed.ts
- Updated standalone execution in seed-app-store.ts to still call
seedAppData() when run directly via 'yarn seed-app-store'
This ensures proper ordering: apps seeded → users created → routing
form data created for existing users.
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* refactor: move routing form seeding from seed-app-store.ts to seed.ts
Moved the routing form seeding logic (previously in seedAppData function)
from seed-app-store.ts to be inline at the bottom of main() in seed.ts.
This ensures the 'pro' user is created before attempting to create routing
form data for them.
Changes:
- Removed seedAppData function and seededForm export from seed-app-store.ts
- Removed import of seedAppData from seed.ts
- Added routing form seeding logic inline at bottom of main() in seed.ts
Seeding order: apps → users (including 'pro') → routing forms
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* fix: add deleted: null filter to bookingReference update operations
- Add deleted: null filter to API v1 PATCH endpoint to prevent updating soft-deleted booking references
- Add deleted: null filter to DailyVideo updateMeetingTokenIfExpired and setEnableRecordingUIAndUserIdForOrganizer
- Add comprehensive test coverage for PATCH endpoint soft-delete behavior
- Tests verify that soft-deleted booking references cannot be updated
- Tests verify that only active booking references can be updated successfully
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* revert: remove deleted: null filters to preserve existing functionality
Per @keithwillcode's feedback, reverting the soft-delete filtering changes to preserve existing functionality in this PR. This PR should focus only on the Prisma upgrade itself.
- Reverted API v1 PATCH endpoint change
- Reverted DailyVideo adapter changes (updateMeetingTokenIfExpired and setEnableRecordingUIAndUserIdForOrganizer)
- Removed test file that was added for soft-delete behavior testing
Addresses comments:
- https://github.com/calcom/cal.com/pull/23816#discussion_r2448854197
- https://github.com/calcom/cal.com/pull/23816#discussion_r2448860594
- https://github.com/calcom/cal.com/pull/23816#discussion_r2448860833
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* test: restore and update booking reference tests to match existing functionality
Updated tests to verify existing behavior where PATCH endpoint can update
booking references regardless of their deleted status. This matches the
current implementation after reverting the deleted: null filters.
Changes:
- Restored test file that was previously deleted
- Updated PATCH tests to expect successful updates of soft-deleted references
- Renamed test suite to 'Existing functionality' to clarify intent
- Tests now verify that the PATCH endpoint preserves existing behavior
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
* test: rename booking-references test to integration-test
The test requires a database connection and should run in the integration
test job, not the unit test job. Renamed from .test.ts to .integration-test.ts
to match the repository's testing conventions.
Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: cal.com <morgan@cal.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* fix: Apply organization brand colors and theme to member personal events
- Fetch organization brand colors and theme in getEventTypesFromDB
- Override user brand colors/theme with org values for personal events
- Apply to booking confirmation pages, user booking pages, and routing forms
- Follow same pattern as hideBranding for consistency
- Fixes issue where org brand colors only applied to team events
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
* fix: Resolve type errors for organization brand color and theme overrides
- Added brandColor, darkBrandColor, theme to ProfileRepository findById organization select
- Updated test mock to include new organization fields
- Ensures consistent organization branding types across all queries
- All type errors related to brand color changes now resolved
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
* fix: Remove redundant profile assignment causing type errors
The spread operator already includes profile when it exists.
Explicit assignment causes type conflicts with union types where
profile is not guaranteed to exist in all branches.
Resolves TypeScript error at bookings-single-view.getServerSideProps.tsx:134
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
* fix: Use eventTypeRaw.profile for organization brand color access
Changed eventType.profile to eventTypeRaw.profile in profile object construction
to fix TypeScript errors where profile property doesn't exist on transformed
eventType object. The eventTypeRaw object maintains the original profile field
from the database query.
Resolves TypeScript errors at lines 155, 158, 161 in
bookings-single-view.getServerSideProps.tsx
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
* fix type error
* refactor: Extract branding logic into getBrandingForEventType utility
- Create getBrandingForEventType utility function that handles organization
brand color overrides for both team and personal events
- For team events: org branding → team branding → null
- For personal events: org branding → user branding → null
- Refactor bookings-single-view to use utility function
- Update team booking page to apply organization brand overrides
- Add organization branding fields to ProfileRepository and team queries
Addresses review feedback from @hariombalhara on PR #24456
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
* Update getBranding.ts
* Change
Set themeBasis to null instead of branding.theme.
* refactor: Simplify branding fallback logic to prevent mixing org/team settings
- Changed getBrandingForEventType to use either parent or team branding entirely
- Simplified team parent branding structure in getServerSideProps
- Prevents inconsistent branding when some properties exist in parent but not others
- Addresses PR review feedback from hariombalhara
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* addressed review
* test: Add comprehensive unit tests for branding utility functions
- Add 20 unit tests covering getBrandingForEventType, getBrandingForUser, and getBrandingForTeam
- Test organization branding override scenarios for both team and personal events
- Test fallback behavior when organization branding is not set
- Test handling of null and optional branding properties
- Verify theme and color inheritance from parent organizations
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
* test: Simplify branding tests to focus on core scenarios
- Reduce from 20 to 8 essential test cases
- Focus on org override and fallback behavior for each utility
- Remove redundant edge case tests while maintaining full coverage
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: hariom@cal.com <hariombalhara@gmail.com>
* move SystemField to features
* migrate workflow service
* merge two tests for team repository
* update imports and migrate team repository
* migrate delegation credential repository
* migrate credential repository
* migrate entityPermissionUtils
* migrate hashedLink service and repository
* migrate membership service
* update imports
* remove file
* migrate buildEventUrlFromBooking
* migrate getAllUserBookings to features
* update imports
* update organizationMock
* migrate slots
* migrate date-ranges to schedules dir
* migrate getAggregatedAvailability
* fix
* refactor
* migrate useCreateEventType hook to features
* migrate assignValueToUser
* migrate validateUsername to auth features
* migrate system field back to lib
* migrate getLabelValueMapFromResponses back to lib
* update imports
* use relative path
* fix type checks
* fix
* fix
* fix tests
* update gh codeowners
* fix
* fix
2025-10-17 06:48:08 -03:00
Joe Au-YeungGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Add subscription start, trial end, and end dates to db
* Add subscription start, trial end, and end date to db
* Write subscription start date on new team subscriptions
* Write subscription start date for new orgs
* Fix typo in stripe billing service file (billling -> billing)
* Use `StripeBillingService.extractSubscriptionDates`
* Remove comments
* Address comment
* Fix typo in file import
* Fix typo in file import
* Add missing SubscriptionStatus enum values
- Add INCOMPLETE, INCOMPLETE_EXPIRED, UNPAID, PAUSED enum values
- These values are referenced in stripe-billing-service.ts status mapping
- Fixes type errors in billing-related code
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Add permission + migration for listMembersPrivate + depends on lsitMember
* Add legacy list members PBAC private logic
* Add checks in team pages + handler
* add list memeber checks for private orgs
* Add permision visibility scope to loading permissions
* getMembers handler
* fix fallback permission
* Verify private teams work with private org
* Apply suggestion from @eunjae-lee
Co-authored-by: Eunjae Lee <hey@eunjae.dev>
* Remove and private scope function and add param to old
---------
Co-authored-by: Eunjae Lee <hey@eunjae.dev>
* fix: Past booking redirect
* fix: rename ENV_PAST_BOOKING_RESCHEDULE_CHANGE to ENV_PAST_BOOKING_RESCHEDULE_CHANGE_TEAM_IDS for clarity
- Renamed environment variable to better reflect that it contains comma-separated team IDs
- Updated all references in constants.ts, implementation file, tests, and turbo.json
- Addresses PR comment feedback about misleading variable name
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* mv PaymentPage to web
* mv 2 more components to web
* refactor
* update imports
* mv
* revert
* fix
* fix
* update
* migrate relevant test too
* move setup components to web from appstore
* move wipemycalother
* mv
* fix typechecks
* mv more routing forms components
* fix
* fix
* fix
* fix: resolve type errors in SingleForm.tsx after migration
- Updated SingleFormComponentProps type to include enriched form properties
- Added proper typing for user, team, nonOrgUsername, nonOrgTeamslug, userOrigin, teamOrigin
- Fixes type errors that occurred after migrating SingleForm.tsx from packages/app-store/routing-forms/components/
- Resolves both SingleForm.tsx and TestForm.tsx type errors
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* delete
* refactors
* fix
* fix
* fix
* remove usage of trpc client from OmniInstallAppButton.tsx
* fix test
* import only type
* fix test
* remove trpc package from appstore package.json
* remove remaining trpc usage
* update test
* fix type checks
* fix errors
* fix
* make it error
* nit
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-09-14 12:51:05 +00:00
Joe Au-YeungGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: managed event types inherit team hideBranding setting
- Add getParentTeamForBranding helper to query parent team data
- Update shouldHideBrandingForEvent to use parent team when eventType.team is null
- Ensures CTA 'create your own booking link with Cal' respects team branding settings
- Follows existing pattern used by eventType.team?.id ?? eventType.parent?.teamId
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* chore: update yarn.lock dependencies
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* Get parent event type team branding
* Use data from getEventTypeFromDB
* Undo yarn.lock changes
* Undo yarn.lock changes from latest main
* Address code commit
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* 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>
2025-09-11 15:27:50 +01:00
Peer RichelsenGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>Amit Sharmasean-brydoncoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>