Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. 💤 Files selected but had no reviewable changes (1)
You can disable this status message by setting the WalkthroughAdds schedule-creation across API, platform, libraries, TRPC, and docs. API: new POST /schedules/create on AtomsSchedulesController using CreateScheduleSchema and createScheduleHandler, returning ApiResponse. Platform: new CreateScheduleForm, CreateSchedulePlatformWrapper, useAtomCreateSchedule hook, and re-exports (CreateSchedule, CreateScheduleForm). Libraries: re-exports createScheduleHandler, CreateScheduleHandlerReturn, CreateScheduleSchema. TRPC: narrows ctx.user typing and exports CreateScheduleHandlerReturn. Docs: new create-schedule MDX page and mint.json navigation entry. Pre-merge checks and finishing touches✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Actionable comments posted: 6
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (10)
apps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.ts(4 hunks)docs/mint.json(1 hunks)docs/platform/atoms/create-schedule.mdx(1 hunks)packages/platform/atoms/create-schedule/CreateScheduleForm.tsx(1 hunks)packages/platform/atoms/create-schedule/index.tsx(1 hunks)packages/platform/atoms/create-schedule/wrappers/CreateSchedulePlatformWrapper.tsx(1 hunks)packages/platform/atoms/hooks/schedules/useAtomCreateSchedule.ts(1 hunks)packages/platform/atoms/index.ts(1 hunks)packages/platform/libraries/schedules.ts(1 hunks)packages/trpc/server/routers/viewer/availability/schedule/create.handler.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/review.mdc)
Always use
t()for text localization in frontend code; direct text embedding should trigger a warning
Files:
packages/platform/atoms/create-schedule/index.tsxpackages/platform/atoms/create-schedule/CreateScheduleForm.tsxpackages/platform/atoms/create-schedule/wrappers/CreateSchedulePlatformWrapper.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/review.mdc)
Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js
.utc()in hot paths like loops
Files:
packages/platform/atoms/create-schedule/index.tsxapps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.tspackages/platform/libraries/schedules.tspackages/platform/atoms/index.tspackages/trpc/server/routers/viewer/availability/schedule/create.handler.tspackages/platform/atoms/hooks/schedules/useAtomCreateSchedule.tspackages/platform/atoms/create-schedule/CreateScheduleForm.tsxpackages/platform/atoms/create-schedule/wrappers/CreateSchedulePlatformWrapper.tsx
**/*.{ts,tsx,js,jsx}
⚙️ CodeRabbit configuration file
Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.
Files:
packages/platform/atoms/create-schedule/index.tsxapps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.tspackages/platform/libraries/schedules.tspackages/platform/atoms/index.tspackages/trpc/server/routers/viewer/availability/schedule/create.handler.tspackages/platform/atoms/hooks/schedules/useAtomCreateSchedule.tspackages/platform/atoms/create-schedule/CreateScheduleForm.tsxpackages/platform/atoms/create-schedule/wrappers/CreateSchedulePlatformWrapper.tsx
**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/review.mdc)
**/*.ts: For Prisma queries, only select data you need; never useinclude, always useselect
Ensure thecredential.keyfield is never returned from tRPC endpoints or APIs
Files:
apps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.tspackages/platform/libraries/schedules.tspackages/platform/atoms/index.tspackages/trpc/server/routers/viewer/availability/schedule/create.handler.tspackages/platform/atoms/hooks/schedules/useAtomCreateSchedule.ts
🧬 Code graph analysis (5)
apps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.ts (3)
apps/api/v2/src/modules/users/users.repository.ts (1)
UserWithProfile(10-13)packages/platform/types/api.ts (1)
ApiResponse(33-35)packages/trpc/server/routers/viewer/availability/schedule/create.handler.ts (1)
CreateScheduleHandlerReturn(17-17)
packages/trpc/server/routers/viewer/availability/schedule/create.handler.ts (1)
packages/platform/libraries/schedules.ts (2)
CreateScheduleHandlerReturn(11-11)createHandler(10-10)
packages/platform/atoms/hooks/schedules/useAtomCreateSchedule.ts (1)
packages/platform/types/api.ts (3)
ApiSuccessResponse(8-8)ApiErrorResponse(19-24)ApiResponse(33-35)
packages/platform/atoms/create-schedule/CreateScheduleForm.tsx (3)
packages/platform/types/api.ts (1)
ApiErrorResponse(19-24)packages/platform/atoms/hooks/schedules/useAtomCreateSchedule.ts (1)
useAtomCreateSchedule(16-46)packages/ui/components/form/inputs/TextField.tsx (1)
InputField(102-232)
packages/platform/atoms/create-schedule/wrappers/CreateSchedulePlatformWrapper.tsx (5)
packages/platform/atoms/index.ts (2)
CreateSchedulePlatformWrapper(47-47)CreateScheduleForm(48-48)packages/platform/types/api.ts (1)
ApiErrorResponse(19-24)packages/platform/atoms/create-schedule/CreateScheduleForm.tsx (2)
ActionButtonsClassNames(14-18)CreateScheduleForm(20-108)packages/ui/components/dialog/Dialog.tsx (3)
Dialog(35-38)DialogTrigger(168-172)DialogContent(56-117)packages/ui/components/button/Button.tsx (1)
Button(221-349)
🔇 Additional comments (5)
packages/trpc/server/routers/viewer/availability/schedule/create.handler.ts (1)
12-12: LGTM: Type narrowing and export enhance type safety.The narrowing of
ctx.userto only the required fields (id,timeZone,defaultScheduleId) is correct—the handler code (lines 20-76) uses only these properties. ExportingCreateScheduleHandlerReturnprovides a clean public type for API consumers.Also applies to: 17-17
packages/platform/atoms/create-schedule/index.tsx (1)
1-1: LGTM: Clean re-export pattern.The named export follows the coding guidelines and established patterns in the codebase.
packages/platform/atoms/index.ts (1)
47-48: LGTM: Public API exports follow established patterns.The new exports for
CreateScheduleandCreateScheduleFormare consistent with existing aliases (e.g.,CalendarView) and adhere to the named exports guideline.apps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.ts (1)
95-109: LGTM: Secure and well-typed endpoint.The new POST endpoint is properly secured with
ApiAuthGuardandSCHEDULE_WRITEpermissions. The type usage is correct, and the handler invocation properly passes the user context.packages/platform/libraries/schedules.ts (1)
9-13: LGTM: Clean public API exports.The exports provide a well-structured public API surface for schedule creation functionality, using named exports and clear type aliases.
packages/platform/atoms/create-schedule/wrappers/CreateSchedulePlatformWrapper.tsx
Outdated
Show resolved
Hide resolved
packages/platform/atoms/hooks/schedules/useAtomCreateSchedule.ts
Outdated
Show resolved
Hide resolved
packages/platform/atoms/hooks/schedules/useAtomCreateSchedule.ts
Outdated
Show resolved
Hide resolved
supalarry
left a comment
There was a problem hiding this comment.
Good job! I left a question below and NIT comment and let me know about my question:
| onSuccess: (data) => { | ||
| if (data.status === SUCCESS_STATUS) { | ||
| onSuccess?.(data); | ||
| queryClient.invalidateQueries({ queryKey: [ScheduleQueryKey] }); |
There was a problem hiding this comment.
I see here we invalidate ScheduleQueryKey - can you confirm if we have create schedules atom and list schedules atom you recently created that if you have both on the same page and you create a new schedule via create schedule atom that it appears in the list schedules atom and if you do it second time that second schedule appears in the list atom?
There was a problem hiding this comment.
yeah I can check and confirm this. what I was think was once this PR is merged I can update the examples app in my list schedules atom branch to make the availability page similar to https://app.cal.com/availability. does that sound good?
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
apps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.ts(4 hunks)packages/platform/atoms/hooks/schedules/useAtomCreateSchedule.ts(1 hunks)packages/platform/libraries/schedules.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/platform/libraries/schedules.ts
- packages/platform/atoms/hooks/schedules/useAtomCreateSchedule.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/review.mdc)
**/*.ts: For Prisma queries, only select data you need; never useinclude, always useselect
Ensure thecredential.keyfield is never returned from tRPC endpoints or APIs
Files:
apps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/review.mdc)
Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js
.utc()in hot paths like loops
Files:
apps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.ts
**/*.{ts,tsx,js,jsx}
⚙️ CodeRabbit configuration file
Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.
Files:
apps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.ts
🧬 Code graph analysis (1)
apps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.ts (3)
apps/api/v2/src/modules/users/users.repository.ts (1)
UserWithProfile(10-13)packages/platform/types/api.ts (1)
ApiResponse(33-35)packages/trpc/server/routers/viewer/availability/schedule/create.handler.ts (1)
CreateScheduleHandlerReturn(17-17)
🔇 Additional comments (3)
apps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.ts (3)
25-25: LGTM: Zod import added for schema validation.The Zod import is necessary for the
CreateScheduleSchematype inference in the newcreateSchedulemethod.
28-29: LGTM: Required imports for schedule creation.The imports for
CreateScheduleHandlerReturn,CreateScheduleSchema, andcreateScheduleHandlerare correctly sourced from@calcom/platform-libraries/schedulesand necessary for the new endpoint.
92-106: No explicit error handling required here. Global exception filters (Prisma, Zod, Http, TRPC, CalendarService) are registered in app.ts and will catch and format errors thrown bycreateScheduleHandler.
This reverts commit d4520aa.
|
Fixed CI breaking changes check issue in #24445 You now need to revert openapi.json changes you submitted (it needs to be like in main because nothing in your PR changes it) and then merge main into this branch and should work. PS i merged main into here to see if CI would pass previously so pull this branch before making changes. |
What does this PR do?
Visual Demo
loom video:
https://www.loom.com/share/6f019f1ba49a43439032d2d6b434c17c?sid=333d2744-4825-47e8-950d-b99450946925c
https://www.loom.com/share/6f019f1ba49a43439032d2d6b434c17c?sid=4414c519-0c3b-409b-a758-a9ba2fa9804f
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
This can be tested inside the platform examples app