-
Notifications
You must be signed in to change notification settings - Fork 10.4k
refactor: convert getBusyTimes to service class with dependency injection #22949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: convert getBusyTimes to service class with dependency injection #22949
Conversation
…tion - Create BusyTimesService following UserAvailabilityService pattern - Add DI tokens, module, and container setup for BusyTimesService - Update all usage locations to use service instead of direct function calls - Maintain existing function signatures for backward compatibility - Add legacy exports to ensure smooth transition - Update type references in trpc util to use service prototype - Fix linting issues by making legacy exports async with proper imports - All tests pass and type checking succeeds Co-Authored-By: morgan@cal.com <morgan@cal.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (08/08/25)1 reviewer was added to this PR based on Keith Williams's automation. |
E2E results are ready! |
…tion (calcom#22949) * refactor: convert getBusyTimes to service class with dependency injection - Create BusyTimesService following UserAvailabilityService pattern - Add DI tokens, module, and container setup for BusyTimesService - Update all usage locations to use service instead of direct function calls - Maintain existing function signatures for backward compatibility - Add legacy exports to ensure smooth transition - Update type references in trpc util to use service prototype - Fix linting issues by making legacy exports async with proper imports - All tests pass and type checking succeeds Co-Authored-By: morgan@cal.com <morgan@cal.com> * refactor: busy time service * fix: api v2 eslint plugins version mismatch * chore: bump platform libs * chore: bump platform libs * fix: missing di busyTimesModule in slots service --------- 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>
refactor: convert getBusyTimes to service class with dependency injection
Summary
This PR refactors the
packages/lib/getBusyTimes.ts
file from standalone functions to a service class using dependency injection, following the same pattern asUserAvailabilityService
. The refactoring includes:BusyTimesService
class with dependency injection forBookingRepository
The main functions (
getBusyTimes
,getBusyTimesForLimitChecks
,getStartEndDateforLimitCheck
) are now methods on the service class, with the same signatures and behavior preserved.Review & Testing Checklist for Human
getBusyTimes
,getBusyTimesForLimitChecks
, orgetStartEndDateforLimitCheck
still workgetStartEndDateforLimitCheck
async doesn't break any calling code that expected synchronous behaviorRecommended test plan: Create a test booking through the UI, verify availability slots are shown correctly, and confirm busy times are properly calculated during the booking process.
Diagram
Notes
UserAvailabilityService
for consistencygetStartEndDateforLimitCheck
function was made async to resolve ESLint linting issues with require statements