Skip to content

Comments

feat: list schedules atom#24205

Merged
Ryukemeister merged 37 commits intomainfrom
rajiv/cal-5508-feature-list-schedules-atom
Oct 15, 2025
Merged

feat: list schedules atom#24205
Ryukemeister merged 37 commits intomainfrom
rajiv/cal-5508-feature-list-schedules-atom

Conversation

@Ryukemeister
Copy link
Contributor

@Ryukemeister Ryukemeister commented Oct 1, 2025

What does this PR do?

  • There is no atom available to list all managed user schedules. Currently, users must rely on the web app’s availability section, which prevents embedding schedule lists into other flows. This PR creates a new ListSchedules atom modeled after the availability section in the web app.

Visual Demo

loom video : https://www.loom.com/share/8e020a4848d543548c519d3a7cd532c6?sid=90ec6908-4ce9-4875-85c3-884684474090

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • (N/A) I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

This can be tested in the examples app for platform in the /availability page

@linear
Copy link

linear bot commented Oct 1, 2025

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 1, 2025

Walkthrough

Replaces inline schedule transformation with a shared transformer getScheduleListItemData and adds a Schedule type and transformer. Introduces a ListSchedules atom and ListSchedulesPlatformWrapper that fetches schedules via a new useAtomGetAllSchedules hook, transforms them, and renders ScheduleListItem components which now accept a redirectUrl prop. Adds hooks useAtomDuplicateSchedule, useEnsureDefaultSchedule, and exposes TRPC handler aliases and return types plus API endpoints to list and duplicate atom schedules. Adds example Next.js availability pages, MDX docs, and updates/skips an availability e2e test.

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title “feat: list schedules atom” concisely and accurately summarizes the primary change of introducing a new ListSchedules atom, following a clear conventional commit style without extraneous detail.
Description Check ✅ Passed The description clearly outlines the creation of the ListSchedules atom, provides relevant motivation and context, includes a demo video link, and offers testing instructions directly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rajiv/cal-5508-feature-list-schedules-atom

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@keithwillcode keithwillcode added core area: core, team members only platform Anything related to our platform plan labels Oct 1, 2025
@pull-request-size pull-request-size bot added size/L and removed size/M labels Oct 5, 2025
@vercel
Copy link

vercel bot commented Oct 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Oct 15, 2025 11:09am
cal-eu Ignored Ignored Oct 15, 2025 11:09am

@pull-request-size pull-request-size bot removed the size/L label Oct 8, 2025
@Ryukemeister Ryukemeister dismissed stale reviews from ThyMinimalDev and supalarry via 21c4684 October 14, 2025 23:07
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 7668026 and cd7ea43.

📒 Files selected for processing (1)
  • packages/platform/libraries/schedules.ts (1 hunks)
🧰 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 use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/platform/libraries/schedules.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:

  • packages/platform/libraries/schedules.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:

  • packages/platform/libraries/schedules.ts

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.ts (1)

76-89: Consider pagination for scalability.

The endpoint fetches all user schedules without pagination. While this may be acceptable for the current atom use case, consider adding optional pagination parameters (limit/offset or cursor-based) to handle users with many schedules as the platform scales.

📜 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 89bdf0e and 1684a56.

📒 Files selected for processing (1)
  • apps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.ts (3 hunks)
🧰 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 use include, always use select
Ensure the credential.key field 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/platform/libraries/schedules.ts (2)
  • GetAvailabilityListHandlerReturn (17-17)
  • DuplicateScheduleHandlerReturn (21-21)
🔇 Additional comments (2)
apps/api/v2/src/modules/atoms/controllers/atoms.schedules.controller.ts (2)

28-32: LGTM!

The imports are well-structured, with type-only imports properly declared and handlers co-located with their return types.


128-142: Ownership validation present in duplicate schedule handler. The handler checks schedule.userId === ctx.user.id and throws UNAUTHORIZED otherwise, preventing unauthorized duplication.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 1684a56 and 8b6de22.

📒 Files selected for processing (2)
  • packages/platform/atoms/hooks/schedules/useAtomCreateSchedule.ts (2 hunks)
  • packages/platform/examples/base/src/pages/availability/index.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/platform/atoms/hooks/schedules/useAtomCreateSchedule.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:

  • packages/platform/atoms/hooks/schedules/useAtomCreateSchedule.ts
  • packages/platform/examples/base/src/pages/availability/index.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/hooks/schedules/useAtomCreateSchedule.ts
  • packages/platform/examples/base/src/pages/availability/index.tsx
**/*.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/examples/base/src/pages/availability/index.tsx
🧬 Code graph analysis (1)
packages/platform/examples/base/src/pages/availability/index.tsx (2)
packages/platform/examples/base/src/pages/availability/[scheduleId].tsx (1)
  • Availability (12-104)
packages/platform/examples/base/src/components/Navbar/index.tsx (1)
  • Navbar (7-48)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (2)
packages/platform/atoms/hooks/schedules/useAtomCreateSchedule.ts (1)

9-9: LGTM! Cache invalidation correctly extends to the new schedules list.

The import and cache invalidation for SchedulesQueryKey properly ensure that the list of all schedules is refreshed after a schedule is created, maintaining consistency with the existing pattern for invalidating the individual schedule cache.

Also applies to: 39-39

packages/platform/examples/base/src/pages/availability/index.tsx (1)

9-21: LGTM! Well-structured availability page.

The component correctly renders the Navbar and both atoms (CreateSchedule and ListSchedules) with appropriate props. The getScheduleUrl callback properly maps schedule IDs to the expected route structure, and the data-testid attributes enable effective E2E testing.

@graphite-app graphite-app bot requested a review from a team October 15, 2025 00:09
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.changeset/lemon-rice-smile.md (1)

5-5: Clarify the summary sentence.

The wording is a bit awkward (“also another atom introduced”). Rephrasing makes the changeset summary clearer.

-This PR adds an atom to list a user's schedule. Furthermore, there was also another atom introduced which can be used to create a new schedule for a user.
+This PR adds an atom that lists a user's schedules and introduces another atom that can create a new schedule for a user.
📜 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 8b6de22 and 7ba3939.

📒 Files selected for processing (1)
  • .changeset/lemon-rice-smile.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
.changeset/lemon-rice-smile.md

[grammar] ~5-~5: There might be a mistake here.
Context: ...sed to create a new schedule for a user.

(QB_NEW_EN)

@Ryukemeister
Copy link
Contributor Author

@supalarry regarding this comment on PR #24404

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?

I can confirm this is the case, I have the create schedule atom and list schedules on the same page and as soon as I create a new schedule it can be seen in the list atom. You can test it in the /availability page of the example app

@Ryukemeister Ryukemeister disabled auto-merge October 15, 2025 11:03
@Ryukemeister Ryukemeister merged commit 0757b00 into main Oct 15, 2025
38 checks passed
@Ryukemeister Ryukemeister deleted the rajiv/cal-5508-feature-list-schedules-atom branch October 15, 2025 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only ✨ feature New feature or request platform Anything related to our platform plan ready-for-e2e size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants