Skip to content

Conversation

@JeanMeijer
Copy link
Collaborator

@JeanMeijer JeanMeijer commented Dec 2, 2025

Description

Briefly describe what you did and why.

Screenshots / Recordings

Add screenshots or recordings here to help reviewers understand your changes.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • UI/UX update
  • Docs update
  • Refactor / Cleanup

Related Areas

  • Authentication
  • Calendar UI
  • Data/API
  • Docs

Testing

  • Manual testing performed
  • Cross-browser testing (if UI changes)
  • Mobile responsiveness verified (if UI changes)

Checklist

  • I’ve read the CONTRIBUTING guide
  • My code works and is understandable and follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in complex areas
  • I have updated the documentation
  • Any dependent changes are merged and published

Notes

(Optional) Add anything else you'd like to share.

By submitting, I confirm I understand and stand behind this code. If AI was used, I’ve reviewed and verified everything myself.


Summary by cubic

Refactored the calendar and event data model to use a nested calendar object with provider details, replacing scattered accountId/calendarId fields. This simplifies API contracts, improves event moving/sync, and aligns providers, web app, and schemas around one consistent structure.

  • Refactors

    • Events now use calendar: { id, provider: { id: "google" | "microsoft", accountId } }; calendars use provider with the same shape.
    • Updated TRPC routers, schemas, and providers (Google/Microsoft) to the new shape, including move/update/delete and sync endpoints.
    • Web UI switched to calendar.provider.accountId for color/visibility and updated all event/calendar interactions (picker, context menu, form, optimistic actions).
    • Local DB (Dexie) bumped to v2 with mapping helpers; indices updated; query cache buster set to invalidate old persisted data.
    • Accounts and tasks APIs now return/accept provider objects; removed legacy provider/account fields from forms and interfaces.
  • Migration

    • Update API consumers to send/handle calendar objects instead of accountId/calendarId/providerId.
    • Events: create/patch/delete/get/move now require calendar { id, provider { id, accountId } }.
    • Calendars: get/update/delete use provider { id, accountId } + calendarId.
    • Tasks: create uses provider { id, accountId }.
    • Local dev: IndexedDB upgrades automatically; if issues, clear browser storage. Persisted query cache is auto-busted.

Written for commit dde369a. Summary will update automatically on new commits.

@coderabbitai
Copy link

coderabbitai bot commented Dec 2, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

@vercel
Copy link

vercel bot commented Dec 2, 2025

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

Project Deployment Preview Comments Updated (UTC)
analog Ready Ready Preview Comment Dec 2, 2025 0:22am

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

3 issues found across 52 files

Prompt for AI agents (all 3 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/web/src/components/calendar/context/calendar-colors-provider.tsx">

<violation number="1" location="apps/web/src/components/calendar/context/calendar-colors-provider.tsx:34">
P2: Rule violated: **CSS variable naming and usage conventions (Tailwind v4 namespaces)**

`calendarColorVariable` produces `--calendar-color-*`, which is outside the allowed Tailwind v4 namespaces (`--color-*`, `--font-*`, etc.). Using it on this line perpetuates a token name that cannot be consumed via the required `var(--color-…)` conventions.</violation>
</file>

<file name="packages/api/src/routers/accounts.ts">

<violation number="1" location="packages/api/src/routers/accounts.ts:39">
P2: `provider.id` is incorrectly asserted to only &quot;google&quot; | &quot;microsoft&quot; even though accounts can also have provider &quot;zoom&quot;, leading to incorrect TRPC output types and downstream handling bugs.</violation>
</file>

<file name="apps/web/src/lib/db.ts">

<violation number="1" location="apps/web/src/lib/db.ts:40">
P1: Version 2 removes the stored `accountId` field in favor of `providerAccountId` without a Dexie upgrade/backfill, so previously persisted events/calendars lose their account association. Add an `.upgrade(...)` that copies the old `accountId` value into `providerAccountId` (and removes the deprecated column) before relying on the new indexes.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

providerAccountId: account.accountId,
providerId: account.providerId,
provider: {
id: account.providerId as "google" | "microsoft",
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 2, 2025

Choose a reason for hiding this comment

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

P2: provider.id is incorrectly asserted to only "google" | "microsoft" even though accounts can also have provider "zoom", leading to incorrect TRPC output types and downstream handling bugs.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/api/src/routers/accounts.ts, line 39:

<comment>`provider.id` is incorrectly asserted to only &quot;google&quot; | &quot;microsoft&quot; even though accounts can also have provider &quot;zoom&quot;, leading to incorrect TRPC output types and downstream handling bugs.</comment>

<file context>
@@ -33,8 +35,10 @@ export const accountsRouter = createTRPCRouter({
-        providerAccountId: account.accountId,
-        providerId: account.providerId,
+        provider: {
+          id: account.providerId as &quot;google&quot; | &quot;microsoft&quot;,
+          accountId: account.accountId,
+        },
</file context>
Suggested change
id: account.providerId as "google" | "microsoft",
id: account.providerId as "google" | "microsoft" | "zoom",
Fix with Cubic

@JeanMeijer JeanMeijer changed the title feat(api): improve calendar data structure feat(api): improve d data structure Dec 2, 2025
@JeanMeijer JeanMeijer changed the title feat(api): improve d data structure feat(api): improve calendar data structure Dec 2, 2025
@JeanMeijer JeanMeijer merged commit ad666c0 into main Dec 2, 2025
8 checks passed
@JeanMeijer JeanMeijer deleted the feat/improve-data-structure branch December 2, 2025 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants