* refactor: replace TRPCError with ErrorWithCode in packages/features
This refactor moves error handling from throwing TRPCError directly in
packages/features to throwing ErrorWithCode instead. The conversion to
TRPCError now happens at the TRPC layer.
Changes:
- Add generic ErrorCode values (Unauthorized, Forbidden, NotFound,
BadRequest, InternalServerError) to errorCodes.ts
- Update getServerErrorFromUnknown to map new ErrorCodes to proper
HTTP status codes
- Create toTRPCError helper in packages/trpc/server/lib
- Create errorMappingMiddleware in packages/trpc/server/middlewares
- Migrate TRPCError throws in packages/features to ErrorWithCode:
- teamService.ts
- getEventTypeById.ts
- eventTypeRepository.ts
- OrganizationPermissionService.ts
- OrganizationPaymentService.ts
- sso.ts
- handleCreatePhoneCall.ts
- userCanCreateTeamGroupMapping.ts
This improves separation of concerns by making packages/features
transport-agnostic, allowing the same feature code to be reused from
tRPC, API routes, workers, etc.
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* fix: remove isTrpcCall parameter and fix lint warning
- Remove isTrpcCall parameter from get.handler.ts call since the
feature layer no longer needs to know about tRPC
- Fix unsafe optional chaining lint warning in getEventTypesByViewer.ts
by precomputing usersSource variable
- Complete migration of getEventTypesByViewer.ts to ErrorWithCode
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* revert
* add eslint rule
* add comment
* fix: add isTrpcCall back to getEventTypeById interface
The user reverted the removal of isTrpcCall parameter from the handler,
so we need to add it back to the interface to fix the type error.
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* test: update teamService tests to expect ErrorWithCode instead of TRPCError
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* refactor
* wip
* feat: integrate errorMappingMiddleware into base TRPC procedure
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* connect middlewares
* revert
* revert
* refactor
* rename
* fix: handle ErrorWithCode in teams server-page error handling
The error handling was checking for TRPCError, but teamService now throws
ErrorWithCode. This caused the 'This invitation is not for your account'
error message to not be displayed when a wrong user tries to use an
invitation link.
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
* fix
* fix
* fix
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* chore: refactor config files to prevent migration tool errors
* refactor: upgrade with the tailwind migration tool
* chore: restore pre-commit command + mc
* refactor(wip): update dependencies and migrate to Tailwind CSS v4 (mainly web)
* chore: resolve Tailwind v4 migration conflicts from merging main
* chore: remove unused Tailwind packages from config and update dependencies for v4 migration
* chore: uncomment Tailwind CSS utility classes in globals.css
* fix: resolve token conflicts between calcom and coss ui
* fix: textarea scrollbar
* Fix CUI-16
* fix: added @tailwindcss/forms plugin and cleaned up CSS classes in various components to remove unnecessary dark mode styles
* fix: selects and inputs of different sizes
* fix: remove unnecessary leading-20 class from modal titles in various components
* fix: update Checkbox component styles to remove unnecessary border on checked state
* fix: clean up styles in RequiresConfirmationController, Checkbox, and Radio components to enhance consistency
* fix: update button and filter component styles to remove unnecessary rounded classes for consistency
* fix: calendar
* fix: update KBarSearch
* fix: refine styles in Empty and Checkbox components for improved consistency
* Fix focus state email input
* fix: update button hover and active states to use 'not-disabled' instead of 'enabled'
* fix: line-height issues
* fix: update class name for muted background in BookingListItem component
* fix: sidebar spacing
* chore: update class names to use new Tailwind CSS color utilities
* fix embed
* chore: upgrade Tailwind CSS to version 4.1.16 and update related dependencies
* Map css variables and add a playground test for heavy css customization
* suggestion for coss-ui
* refactor: update CSS variable usage and clean up styles
- Replace instances of `--cal-brand-color` with `--cal-brand` in embed-related HTML files.
- Remove the now-unnecessary `addAppCssVars` function from the embed core.
- Import theme tokens in the embed core styles for better consistency.
- Clean up whitespace and formatting in CSS files for improved readability.
- Add a comment in `tokens.css` regarding its usage in both embed and webapp contexts.
* Handle within tokens.css instead of fixing coss-ui
* Remove initial, not needed. Also, remove tailwind.config.js as tailwidn scans the html automaically
* fix: examples app breaking
* fix: modal not resizing correctly
* feat: upgrade atoms to tailwind v4
* fix: atoms build breaking
* fix: atoms build breaking
* chore: upgrate examples/base to tailwind 4
* chore: update globals.css
* fix: add missing scheduler css variables
* fix: PlatformAdditionalCalendarSelector
* chore: update global styles
* chore: update tailwindcss and postcss dependencies to stable versions
* chore: remove unneeded class
* fix: dialog and toast animation
* fix: replace flex-shrink-0 with shrink-0 for consistent styling in various components
* fix: dialog modal for Apple connect
* add margin in SaveFilterSegmentButton
* Fix radix button nested states
* add cursor pointer to buttons but keep dsabled state
* Fix commandK selectors and adds cursor pointer
* Fix teams filter
* fix - round checkboxes
* fix filter checkbox
* fix select indicator's margin
* command group font size
* style: fix badge and tooltip radius
* chore: remove unneeded files
* Delete PR_REVIEW_MANAGED_EVENT_REASSIGNMENT.md
* remove ui-playground leftover
* fix: add missing react phone input styles in atoms
* Delete managed-event-reassignment-flow-and-architecture.mermaid
* fix: inter font not loading
* Add theme to skeleton container so that it can support dark mode
* fix: create custom stack-y-* utilities post tw4 upgrade
* fix: typo
* fix: atoms stack class + remove unused css file
* fix default radius valiue
* fix space-y in embed
* fix skeleton background
* Hardcode radius values to match production
* fix border in embed
* add missing externalThemeClass
* feat: create a custom stack-y-* utility
* fix: add stack utility to atom global css
* fix: Skeleton loader class modalbox
* Add stack-y utility in embed
* fix: add missing stack utilities in atoms globals.css
* update yarn.lock
* add popover portla
* update
---------
Co-authored-by: Sean Brydon <sean@cal.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
Co-authored-by: Ryukemeister <sahalrajiv6900@gmail.com>
Co-authored-by: cal.com <morgan@cal.com>
Co-authored-by: Eunjae Lee <hey@eunjae.dev>
Co-authored-by: Anik Dhabal Babu <adhabal2002@gmail.com>
2025-11-25 17:32:28 -03:00
Volnei MunhozGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Improve add users to org
* Improve add users to org
* test: Add comprehensive tests for handleUserEvents cross-tenant hijack prevention
- Add tests for cross-tenant hijack prevention security fix
- Test that users belonging to different organizations are blocked
- Test that users with null organizationId are blocked (prevents legacy user hijacking)
- Test that users belonging to correct organization succeed
- Test new user creation flow
- Test user activation/deactivation flows
- Test custom attribute syncing
- All 8 tests passing locally with proper type safety (no 'as any' usage)
Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-11-21 12:18:41 -03:00
Eunjae LeeGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* refactor: make DataTableProvider framework-agnostic by requiring tableIdentifier
- Remove Next.js usePathname dependency from DataTableProvider
- Make tableIdentifier a required prop instead of optional
- Update all usages to provide explicit tableIdentifier values
- This makes DataTableProvider usable in non-Next.js contexts
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* refactor: use usePathname at usage sites instead of hardcoding tableIdentifier
- Add validation in DataTableProvider for empty/nullish tableIdentifier
- Use usePathname() in Next.js apps to pass pathname as tableIdentifier
- Use descriptive identifiers for non-Next.js package components
- This keeps DataTableProvider framework-agnostic while allowing Next.js apps to use pathname
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* use pathname instead of hard-coded identifiers
* change type of tableIdentifier
* simplify
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-10-23 15:32:16 +02: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>
* 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
* Fix membership deletion handling and add tests
* fixes
* revert api-v2 specific changes
* Add more tests
* refactor: Move removeMember function into TeamService as private static methods
- Moved removeMember and all related helper functions from separate file into TeamService class
- Made all functions private static methods instead of exporting them
- Deleted the original removeMember.ts file since it's no longer needed
- Updated imports to use the new location
- All integration tests pass successfully
* refactor: Rename memberId to userId in TeamService methods
- Renamed memberId parameter to userId in removeMember private method
- Renamed memberIds parameter to userIds in removeMembers public method
- Updated all calls to removeMembers to use userIds instead of memberIds
- Parameter names now accurately reflect that they are user IDs, not membership IDs
* test: add service unit tests and simplify e2e tests for membership deletion
- Add unit tests for membership deletion services
- Remove redundant deletion behavior tests from controllers
- Keep only happy path tests in e2e controller tests
- Fix unused imports and variables
* package.json version
* fix unit teswtes
* No specs file
* fix unit tests
* fix: Add platform-libraries build step to E2E API v2 workflow
The E2E API v2 tests were failing with TypeScript compilation errors because
TeamService imports from @calcom/platform-libraries require the package to be
built first to generate the dist/ folder with compiled exports.
This adds the same build step that was added to unit-tests.yml to resolve
the module resolution errors.
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* Making tests clearer and easier to undestand
* chore: bump platform libs
* chore: bump platform libs
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
Co-authored-by: cal.com <morgan@cal.com>
* refactor: convert UserRepository to use dependency injection pattern
- Convert all static methods to public instance methods
- Add constructor that takes PrismaClient parameter
- Update all usage sites to use new instantiation pattern: new UserRepository(prisma).method()
- Follow same pattern as PrismaOOORepository for consistency
- Maintain all existing method logic and signatures unchanged
- Update 125+ files across the codebase to adapt to new pattern
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* optimize: reuse UserRepository instances within same function scope
- Create single UserRepository instance per function scope
- Reuse instance for multiple method calls within same function
- Reduces object instantiation overhead and improves performance
- Apply optimization pattern consistently across codebase
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* fix: repository
* fixup! fix: repository
* fixup! fixup! fix: repository
* fixup! fixup! fixup! fix: repository
* fix: update test mocking strategies for UserRepository dependency injection
- Convert static method mocks to instance method mocks in userCreationService.test.ts
- Update vi.spyOn calls to work with constructor injection pattern in getAllCredentials.test.ts
- Fix UserRepository mocking in getRoutedUrl.test.ts to use constructor injection
- Ensure consistent mocking approach across all test files
- Fix 'UserRepository is not a constructor' errors in tests
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* feat: optimize UserRepository instance reuse and add SessionUser type
- Reuse UserRepository instance in OrganizationRepository.createWithNonExistentOwner
- Add comprehensive SessionUser type definition for type safety
- Improve type constraints in enrichUserWithTheProfile and enrichUserWithItsProfile
- Ensure proper return types with profile information
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* fix: make UserRepository mocking strategy more robust for CI environments
- Add defensive checks for vi.mocked() to handle CI environment differences
- Ensure mockImplementation is available before calling it
- Maintain consistent mocking pattern across all test files
- Fix 'Cannot read properties of undefined' error in CI
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* fixup! fix: make UserRepository mocking strategy more robust for CI environments
* refactor: convert direct UserRepository instantiations to two-step pattern
- Change await new UserRepository(prisma).method(...) to const userRepo = new UserRepository(prisma); await userRepo.method(...)
- Optimize instance reuse within same function scopes
- Apply pattern consistently across all modified files in PR
- Fix type errors in organization.ts and sessionMiddleware.ts
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* refactor: complete two-step UserRepository pattern for remaining files
- Apply two-step instantiation pattern to all remaining modified files in PR
- Ensure consistent UserRepository usage across entire codebase
- Maintain instance reuse optimization within function scopes
Co-Authored-By: morgan@cal.com <morgan@cal.com>
* chore: bump platform libs
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: morgan@cal.com <morgan@cal.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
* feat: 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>
2025-06-17 09:52:02 +03:00
devin-ai-integration[bot]GitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>benny@cal.com <benny@cal.com>
* Add logging to `handleGroupEvents`
* `createUsersAndConnectOrg` skipDuplicates when creating new users
* `ProfileRepository.createMany` to get username from `orgAutoAcceptEmail`
* Refactor `createUsersAndConnectToOrg` to use `createMany` instead of individual db calls
* Add error logging to `sendSignupToOrganizationEmail`
* Move `sendSignupToOrganizationEmail` to a `Promise.allSettled`
* Add `createManyForExistingUsers` and `createManyPromise`
* Move creating existing users profiles to `ProfileRepository.createManyForExistingUsers`
* Move `sendExistingUserTeamInviteEmails` to a `Promise.allSettled`
* Refactor `createUsersAndConnectToOrg` to use `ProfileRepository.createManyPromise`
* Type fix
* Create `generateNewChildEventTypeDataForDB`
* Create `addNewMembersToEventTypes`
* Type fix
* Type fix
* Type fix
* `createMany` new workflowsOnEventTypes
* Introduce `DATABASE_CHUNK_SIZE`
* Batch connect children event types
* Batch connect profiles to existing users
* chore: decouple ui dialog from AppRouter and Atoms
* fix type e2e test
* fix: import dialog from @calcom/ui/components/dialog
* fix: remove log
* fix unit test
* fix
* fix and move data-override-list test to features package
---------
Co-authored-by: hbjORbj <sldisek783@gmail.com>
* 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>
* Okta fixes
* Fix username and name in case of sync from Okta
* Fix username and name in case of sync from Okta
* Add test
* cleanup code and add tests
* migration and init to accept creationSource for new bookings
* V1 create booking
* V1 user creation
* webapp booking + V1 user
* user creation in V1, V2 and webapp
* booking source V2 and fix for v1 user
* fit type
* --fix type
* add test -- WIP
* fix type
* fix type
* ^
* Need more sleep zzz
* -_-
* bump libraries platform
* adds for v2 recurring booking
* fix lint
* instant meetings
* fix: api v2 creation source
* fixup! fix: api v2 creation source
* bump libraries
* add user
* fix test
* fixup! fix test
* add more source
* more source...
* fix type & test --1
* fix type & test --2
* typefix
* fixup test
---------
Co-authored-by: Morgan Vernay <morgan@cal.com>
* feat: Enhance SCIM user attribute handling and sync process
- Introduced a new PR_TODO.md file to track ongoing tasks and fixes.
- Updated `getAttributesFromScimPayload` to accept a directoryId and ignore core user attributes during syncing.
- Modified `handleUserEvents` to pass directoryId when syncing custom attributes.
- Improved attribute creation logic to handle unique options and added support for optional isGroup property in attribute options.
- Added utility function `getOptionsWithValidContains` to ensure valid sub-options in attribute options.
- Updated tests to reflect changes in attribute handling and ensure proper functionality.
This commit addresses issues with user attribute syncing and enhances the overall attribute management process.
* test: Add unit tests for getOptionsWithValidContains utility function
- Introduced a new test file for the getOptionsWithValidContains function.
- Added tests to verify the removal of duplicate options, initialization of empty contains arrays, filtering of non-existent sub-options, and handling of empty options arrays.
- Ensured comprehensive coverage of the utility's functionality to enhance reliability and maintainability.
* feat: improve text filters (WIP)
* move function to bottom
* apply some styles
* fix selection of TextFilterOptions
* rename value to operand
* remove unused file
* merge filters/filters into filters/utils
* fix regression of not putting url params correctly
* move makeWhereClause to filters/utils
* fix negative, empty, and not empty operators
* fix initial filtering from search state (url)
* fix type errors
* do not send an empty array to query
* update yarn.lock
* i18n for text filter operators
* extract logic as useColumnFilters()
* add missing import
* fix type error
* revert yarn.lock
* use i18n
* insensitive text match
* move data-table to @calcom/features
* fix type errors
* fix type errors
* fix type errors
---------
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
* WIP restored from .git cache
* fix exports
* sortable row model
* feat column visibility component
* wip filters with nuqs
* pull in unique values from table into filters
* correctly assign filters via v/f
* inital selection bar refactor
* data-table selection bar + optmistic update of delete
* dynamic link
* migrate member list table to new data-table
* total list shows filtered value > db valuie
* add filters for attributes
* type errors
* make content bigger on lg
* add mb-6 to teams user datatable to match spacing spec
* correctly render multi-badge
* fix: masss asignment optimistic UI
* fix type errors
* remove log
* fix toolbar type error
* chore: Remove debug artifact
* type errors
* Update apps/web/public/static/locales/en/common.json
* use max-w-fit
* chore: Remove unused translation now we don't specify 'mass' in assign
* perf: fix: use the onBlur event to prevent focus loss whilst the list is rerendering
* Move the data-table exports together in the main barrel, then import
* fix exports that were lost in a merge
* fix exports that were lost in a merge
* fix groupteammapping/availbilityslider
* fix overflow problems
* add scrollbar-thin class
* fix type error
* user serverside values for faceted filters
* pass filters to serverside
* filter serverside
* fix team server side filter
* add loaded x of y
* attributes icon change
* correct implementation for text/input attr optimistic
* type check fixes
* fix platform checks
* fix types again
* fix types again
* fix types again
* add use client
* add use client
* fix-types
* fix: Add missing translation in EN
* fix e2e tests via testid
* fix e2e tests via testid
* fix: Member invite popup not popping up
* Update copyInviteLink to new-member-button testid
* Hopefully fix test ids this time
* fix: Use the right buttons on the right pages
---------
Co-authored-by: Alex van Andel <me@alexvanandel.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
* fix: Error in team members migration during org onboarding
* Add invitationMemberHandler tests
* Add unit tests
* Improve tests and refactor
* Improve tests and refactor
* Fix type issue
* Fix createNewUsersConnectToOrgIfExists args
* fix: Support adding an non-existent email as the owner of the organization
* Remove dead code
* fixes
* add test
* self review changes
* Update packages/trpc/server/routers/viewer/organizations/create.handler.ts
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
* Fix typo everywhere
---------
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
* fix: [CAL-3374] Says Number is not Verified, but it is Verified
* clearing error only when verified
* type-checks fixed
* chore: improvement
---------
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: Udit Takkar <udit222001@gmail.com>
* feat(appStore): add isOAuth config
* refactor(appStore): EventTypeAppSettngsInterface
* refactor(qr_code): split EventTypeAppCardInterface and EventTypeAppSettingsInterface
* feat(appStore): redirect to onboarding for stripe and basecam
* fix(ui/ScrollableArea): overflow indicator not working
* feat(apps): new install app flow
* fix(configureStep): get disabled props for settings
* fix: getAppInstallsBySlug now use teamIds
* chore: Alby to AppSettingsInterface
* chore: Giphy to appsettings interface
* chore: GTM migration
* chore: GT4 - migration
* chore: fathom migration
* chore: paypal
* feat: basecamp migration
* feat: metapixel migration
* feat:plausable
* feat:stripe
* fix merge issues
* fix merge issues in new app install flow steps
* wip: callback to onboarding
* fix: imports
* fix: more imports
* feat: use redirect to onboarding on install flow
* feat: New app install flow 2 (#14077)
* fix: redirect to event-type after oauth flow
* When clicking on install new app button, only redirect to the new app install flow if it is an oAuth app or an app that extends the EventType feature in it's config
* code refactor, skip event-type step
* removed extra consoles
* so that no one can change the eventTypeId in url
* theme support enabled
* only pass eventTypeId instead of whole evetType obj to OmniInstallAppButton
* fix: clicking on event-type gives error and redirects to /apps
* saved appOnboardingRedirectUrl to OAuth State
* fix: a user having no team breaks the onboarding flow
* add optional chaining to appMetadata.extendsFeature and appMetadata.isOAuth;
* encode appOnboardingRedirectUrl
* fix: dark theme ui issues
* skip configure step if no-event types
if user/team does not have event-type then skip configure step and goto apps/installed/[category]
* exclude calendars from apps- onboarding flow
* Update getAppOnboardingRedirectUrl.ts
* fix: On configure step, inputs aren't showing errors
* change route from `apps/onboarding` to `apps/installation`
* fix: flow not correctly working for teams
* should only allow team ADMIN or OWER to install an app to team
* Prevent two payment apps to be enabled
* removed loading state
* Fix type error
* undo new-app-flow from OmniInstallAppButton
* remove OAuth Step, handle step numbering
* fix: redirect url
* getAppOnboardingRedirectUrl refactor
* for debugging
* Revert "for debugging"
This reverts commit b9362c1a8f47f2280e684c213d7ec08d04a8ac4c.
* fix: added toaster
* feat: added support to select multiple events (almost)
* hide button
* Move inner form outside outer form using portal
Due to limitations with nested forms in React Hook Form, moved the inner form outside the outer form using a portal to ensure proper form handling.
* submit buttons refs madness
* removed configure step
we had to use query params to manage selected event-types, between routes which was causing 2 issues:
* each time we selected or unselected an event the whole page was reloaded including getserversideprops being called again and again
* the form was reloaded causing more issues
* removed extra unwanted code
* small fix
* fix: type error
* fix: types
* implemented suggested changes
* removed step footer
* fixed error.message
* removed commented styles
* removed step footer
* fix: Display team event types instead of user's on event types step when team selected
* fix: typo
* removed shouldLockDisableProps
* refactor setUpdatedEventTypesStatus, fix type
* removed extra code
* can't delete while saving
* added translations
* fix: loading in select account step, fix handle onSelect params type
* Fix typo
---------
Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com>
* fix: type errors
* fix: failing tests
---------
Co-authored-by: sean-brydon <sean@cal.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com>
Co-authored-by: Somay Chauhan <somaychauhan98@gmail.com>
* WIP
Adds the capability to add SSO setup in orgs
if you are an Admin or an Owner of the org
* remove sso setup from teams
* allows account creation on first login
* auto-add on login and dsync fixes
* allow SP & idP initiated login for SAML
* revert change to checkIfUserShouldbelongToOrg
* fixes SP initiated Login for first time
* removed stale comment
* code improvement
* --
* minor fixes
* more fix
* add description for non-admin sso settings page
* Set unique tenant
* Rely on current DB for dsync data
* Fix rendering dsync config
* Remove console.log
* Address feedback
* Add relationship between dsync data and team group mapping
* Fix `dsyncData` and `organizationSetting` relationship