Skip to content

Add task support for calendar #3139

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

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

phatgg221
Copy link
Collaborator

@phatgg221 phatgg221 commented Jun 20, 2025

Summary by CodeRabbit

  • New Features
    • Introduced an "Add Event" button and modal in the workspace calendar, allowing users to create and schedule tasks directly from the calendar interface.
    • The event creation form supports task details, duration, split options, time reference, and scheduling constraints, with real-time validation and feedback.
  • Database
    • Added a new calendar tasks table to support event scheduling, including task metadata, scheduling, and priority fields.
    • Introduced new enums for task time reference and priority levels.

Copy link

graphite-app bot commented Jun 20, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

Copy link
Contributor

coderabbitai bot commented Jun 20, 2025

Walkthrough

This change introduces a workspace calendar task system. It adds a new database table with supporting enums and permissions, updates type definitions, and implements a React modal dialog for adding events. The web client integrates the modal and button, enabling users to create and schedule tasks within a workspace calendar.

Changes

File(s) Change Summary
apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/client.tsx Added state and handlers for an "Add Event" modal, imported and rendered AddEventButton and AddEventModal, and integrated them with the calendar UI.
apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-button.tsx Introduced a new AddEventButton React component that triggers a callback when clicked, styled for responsive layouts.
apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx Implemented a new AddEventModal React component with a form for creating calendar tasks, including validation, state management, and database insertion logic.
packages/types/src/supabase.ts Added types for the new workspace_calendar_tasks table, new enums (calendar_task_time, priority_status), updated the tasks table with new optional fields, removed workspace_whiteboards table, and added corresponding constant arrays for the new enums.
apps/db/supabase/migrations/20250620145741_add_calendar_tasks_table.sql Created the workspace_calendar_tasks table and supporting enums in the database, set up row-level security, insert policies, permissions, and foreign key constraints, and defined all necessary columns.
apps/db/supabase/migrations/20250621070438_alter_tasks_table.sql Dropped policies and permissions on deprecated tables, removed constraints, dropped deprecated tables, added new columns to tasks table (some later made nullable), re-established keys and foreign keys on workspace_calendar_tasks, and refreshed the time_tracking_session_analytics view with new session analytics fields.
apps/db/supabase/migrations/20250621074218_new_migration.sql Altered list_id column in tasks table to be nullable and created/replaced the time_tracking_session_analytics view with enriched session analytics data.
apps/db/supabase/migrations/20250621082137_new_migration.sql Dropped and recreated the time_tracking_session_analytics view with detailed session, category, and task metadata, including computed timing fields and session length categorization.
apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/tasks-sidebar-content.tsx Added six new nullable properties related to calendar task scheduling and priority to ExtendedWorkspaceTask objects in the memoized allTasks computation.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant WebClient
    participant AddEventButton
    participant AddEventModal
    participant SupabaseDB

    User->>AddEventButton: Click "Add Event"
    AddEventButton->>WebClient: Trigger open modal handler
    WebClient->>AddEventModal: Render modal (isOpen=true)
    User->>AddEventModal: Fill form and submit
    AddEventModal->>SupabaseDB: Insert new task into workspace_calendar_tasks
    SupabaseDB-->>AddEventModal: Respond with success or error
    AddEventModal->>WebClient: Close modal on success
Loading

Suggested labels

calendar

Suggested reviewers

  • vhpx

Poem

A calendar hops with a brand-new delight,
Add Event pops up, shining bright!
Tasks and durations, priorities too,
All in a modal, just for you.
With enums and tables, the backend’s in tune—
This bunny’s now ready to plan out your June!
🗓️🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx

Oops! Something went wrong! :(

ESLint: 9.29.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@typescript-eslint/parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:201:49)

apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/tasks-sidebar-content.tsx

Oops! Something went wrong! :(

ESLint: 9.29.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@typescript-eslint/parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:201:49)

packages/types/src/supabase.ts

Oops! Something went wrong! :(

ESLint: 9.29.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@typescript-eslint/parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:201:49)

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch feat-scheduler-db-and-functionality

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @phatgg221, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces the foundational database schema and user interface for a new calendar task scheduling feature. It enables users to define and store detailed tasks with various properties and constraints, laying the groundwork for future scheduling functionality.

Highlights

  • Database Schema Introduction: A new workspace_calendar_tasks table has been added to the Supabase database. This table is designed to store details for calendar-related tasks, including their name, duration, splittability, scheduling constraints, and priority. Two new enum types, calendar_task_time and priority_status, were also introduced to support task properties.
  • Calendar Task Creation UI: New UI components, AddEventButton and AddEventModal, have been integrated into the calendar page. These components provide a user-friendly interface for creating new tasks, allowing users to input task details, define duration settings (total, min/max split), and specify scheduling preferences.
  • Data Persistence Integration: The newly developed task creation UI is fully integrated with Supabase, enabling users to persist their defined calendar tasks directly into the workspace_calendar_tasks table. This ensures that created tasks are saved and can be retrieved for scheduling.
  • Database Schema Refinements: Subsequent database migrations refined the workspace_calendar_tasks table by adding description and total_duration columns, and by changing the data types of min_split_duration_minutes and max_split_duration_minutes from smallint to real for more flexible duration input.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

codecov bot commented Jun 20, 2025

Codecov Report

Attention: Patch coverage is 0% with 569 lines in your changes missing coverage. Please review.

Project coverage is 0.79%. Comparing base (0dbe249) to head (8981c08).
Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
...d)/[wsId]/calendar/components/add-event-dialog.tsx 0.00% 511 Missing and 1 partial ⚠️
...pp/[locale]/(dashboard)/[wsId]/calendar/client.tsx 0.00% 28 Missing ⚠️
...d)/[wsId]/calendar/components/add-event-button.tsx 0.00% 20 Missing and 1 partial ⚠️
[...sId]/calendar/components/tasks-sidebar-content.tsx](https://app.codecov.io/gh/tutur3u/platform/pull/3139?src=pr&el=tree&filepath=apps%2Fweb%2Fsrc%2Fapp%2F%5Blocale%5D%2F%28dashboard%29%2F%5BwsId%5D%2Fcalendar%2Fcomponents%2Ftasks-sidebar-content.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u#diff-YXBwcy93ZWIvc3JjL2FwcC9bbG9jYWxlXS8oZGFzaGJvYXJkKS9bd3NJZF0vY2FsZW5kYXIvY29tcG9uZW50cy90YXNrcy1zaWRlYmFyLWNvbnRlbnQudHN4) 0.00% 6 Missing ⚠️
packages/types/src/supabase.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3139      +/-   ##
==========================================
- Coverage    0.80%    0.79%   -0.01%     
==========================================
  Files        2569     2571       +2     
  Lines      328124   328680     +556     
  Branches     3071     3073       +2     
==========================================
  Hits         2625     2625              
- Misses     323306   323860     +554     
- Partials     2193     2195       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new database table workspace_calendar_tasks for managing scheduler tasks, along with associated UI components for adding these tasks. Key changes include new database migrations, a dialog for task creation, and updates to the calendar client page.

Several critical and high-severity issues need addressing:

  1. A major security concern arises from disabling Row Level Security (RLS) on the workspace_calendar_tasks table while having broad default grants, potentially exposing task data.
  2. A hardcoded email address in the task creation dialog needs to be removed or made dynamic.
  3. The data type for total_duration in the database should be reviewed for better suitability (e.g., numeric instead of text).
  4. There are minor naming inconsistencies in database object names and potential confusion regarding duration units between the UI and database.

Overall, the functionality additions are significant, but the security and data modeling aspects require careful review and correction before merging.

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: 10

🧹 Nitpick comments (6)
apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-button.tsx (2)

5-8: Remove unused prop from interface.

The wsId prop is defined in the interface but not used in the component implementation.

interface AddEventButtonProps {
-  wsId: string;
  onOpenDialog?: () => void;
}
-export default function AddEventButton({ onOpenDialog }: AddEventButtonProps) {
+export default function AddEventButton({ onOpenDialog }: AddEventButtonProps) {

10-22: Component implementation looks good, but consider adding tests.

The button component is well-structured with appropriate styling and accessibility. However, static analysis indicates missing test coverage.

Consider adding unit tests to cover the component's render and click behavior.

apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/client.tsx (1)

49-68: Clean integration of new components with existing calendar.

The use of React Fragment to wrap both the existing SmartCalendar and the new AddEventModal is a good approach that maintains the existing component structure while adding new functionality.

Static analysis indicates these lines lack test coverage. Consider adding integration tests to ensure the modal state management and component rendering work correctly.

apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx (2)

223-236: Improve accessibility with proper ARIA attributes.

The required field indicator should be accessible to screen readers.

              <Label htmlFor="task-title">
-                Task Name <span className="text-destructive">*</span>
+                Task Name <span className="text-destructive" aria-label="required">*</span>
              </Label>
              <Input
                id="task-title"
                placeholder="e.g., Complete project documentation"
                value={formData.name}
                onChange={(e) => updateFormData('name', e.target.value)}
                className={errors.name ? 'border-destructive' : ''}
+                aria-required="true"
+                aria-describedby={errors.name ? 'task-title-error' : undefined}
              />
              {errors.name && (
-                <p className="text-sm text-destructive">{errors.name}</p>
+                <p id="task-title-error" className="text-sm text-destructive" role="alert">
+                  {errors.name}
+                </p>
              )}

Apply similar patterns to other required fields throughout the form.


2-503: Add comprehensive test coverage for this critical component.

The static analysis indicates zero test coverage for this component, which handles user input, form validation, and database operations.

This component should have tests covering:

  • Form validation scenarios (required fields, numeric constraints, date validation)
  • Database submission success/failure cases
  • User interaction flows (form submission, modal close/reset)
  • Error state handling and display

Would you like me to generate a comprehensive test suite for this component?

packages/types/src/supabase.ts (1)

5065-5168: LGTM! Well-structured calendar tasks table with minor typo in foreign key name.

The new workspace_calendar_tasks table definition is comprehensive and follows good database design patterns. The field types are appropriate, relationships are properly defined, and the structure supports the calendar scheduling functionality effectively.

However, there's a typo in the foreign key constraint name:

-            foreignKeyName: 'workspace_calendar_taskss_creator_id_fkey';
+            foreignKeyName: 'workspace_calendar_tasks_creator_id_fkey';

The extra 's' in "taskss" should be removed for consistency with naming conventions.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b5d64c7 and 8bad6cb.

📒 Files selected for processing (7)
  • apps/db/supabase/migrations/20250620065741_add_calendar_tasks_table.sql (1 hunks)
  • apps/db/supabase/migrations/20250620095114_new_migration.sql (1 hunks)
  • apps/db/supabase/migrations/20250620101647_new_migration.sql (1 hunks)
  • apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/client.tsx (4 hunks)
  • apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-button.tsx (1 hunks)
  • apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx (1 hunks)
  • packages/types/src/supabase.ts (21 hunks)
🧰 Additional context used
🪛 GitHub Check: codecov/patch
apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-button.tsx

[warning] 2-22: apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-button.tsx#L2-L22
Added lines #L2 - L22 were not covered by tests

apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/client.tsx

[warning] 3-4: apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/client.tsx#L3-L4
Added lines #L3 - L4 were not covered by tests


[warning] 14-14: apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/client.tsx#L14
Added line #L14 was not covered by tests


[warning] 25-28: apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/client.tsx#L25-L28
Added lines #L25 - L28 were not covered by tests


[warning] 34-34: apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/client.tsx#L34
Added line #L34 was not covered by tests


[warning] 49-68: apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/client.tsx#L49-L68
Added lines #L49 - L68 were not covered by tests

apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx

[warning] 2-503: apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx#L2-L503
Added lines #L2 - L503 were not covered by tests

packages/types/src/supabase.ts

[warning] 8407-8407: packages/types/src/supabase.ts#L8407
Added line #L8407 was not covered by tests


[warning] 8412-8412: packages/types/src/supabase.ts#L8412
Added line #L8412 was not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: codecov/patch
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Verify generated types
🔇 Additional comments (7)
apps/db/supabase/migrations/20250620095114_new_migration.sql (1)

3-3: ```shell
#!/bin/bash

Search for any enable/disable RLS statements on workspace_calendar_tasks across migrations

rg -n 'workspace_calendar_tasks' -C3 apps/db/supabase/migrations


</details>
<details>
<summary>apps/db/supabase/migrations/20250620101647_new_migration.sql (1)</summary>

`5-7`: **Good improvement: Converting duration fields to real type.**

Changing from `smallint` to `real` allows for more precise duration values (e.g., fractional minutes), which is appropriate for calendar scheduling.

</details>
<details>
<summary>apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/client.tsx (1)</summary>

`25-28`: **Good state management implementation.**

The modal state management with open/close handlers follows React best practices and provides a clean API for the child components.

</details>
<details>
<summary>packages/types/src/supabase.ts (4)</summary>

`8250-8250`: **LGTM! Appropriate enum values for calendar task time classification.**

The `calendar_task_time` enum with 'working_time' and 'personal_time' values provides a clean way to categorize calendar tasks by time type.

---

`8255-8255`: **LGTM! Standard priority levels for task management.**

The `priority_status` enum with 'low', 'medium', 'high', and 'critical' values follows common priority classification patterns and will integrate well with task scheduling algorithms.

---

`7738-7743`: **LGTM! Function parameter updates are consistent.**

The parameter additions and reordering in the function definitions maintain type safety and follow existing patterns in the codebase.




Also applies to: 7747-7748

---

`8407-8407`: **LGTM! Constants properly updated for new enums.**

The new enum values are correctly added to the Constants object for runtime access. The static analysis warnings about test coverage are expected for new code and don't indicate an issue with the implementation.




Also applies to: 8412-8412

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

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: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8bad6cb and e442cde.

📒 Files selected for processing (1)
  • apps/db/supabase/migrations/20250620103311_changed_policy_of_tasks_table.sql (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Prettier Check (23)
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Verify generated types
  • GitHub Check: Run tests and collect coverage

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: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e442cde and 212dd3e.

📒 Files selected for processing (2)
  • apps/db/supabase/migrations/20250620103311_changed_policy_of_tasks_table.sql (1 hunks)
  • packages/types/src/supabase.ts (21 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/db/supabase/migrations/20250620103311_changed_policy_of_tasks_table.sql
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Run tests and collect coverage
  • GitHub Check: Verify generated types
  • GitHub Check: Deploy-Preview
  • GitHub Check: Prettier Check (23)
🔇 Additional comments (4)
packages/types/src/supabase.ts (4)

5083-5083: Verify total_duration field consistency

The total_duration field has inconsistent nullability between Row/Update (nullable) and Insert (required). This could cause runtime issues if the field is actually required.

Please verify if total_duration should be required or optional in the database schema, and ensure the TypeScript types match the actual database constraints.

Also applies to: 5107-5107, 5131-5131


8250-8250: LGTM: New calendar_task_time enum properly defined

The new calendar_task_time enum with 'working_time' and 'personal_time' values is well-defined and consistently referenced in both the enum definition and constants section.

Also applies to: 8407-8407


8255-8255: LGTM: New priority_status enum properly defined

The new priority_status enum with 'low', 'medium', 'high', and 'critical' values follows a logical progression and is properly defined in both locations.

Also applies to: 8412-8412


7738-7743: ```shell
#!/bin/bash

Search for function calls across relevant file extensions without relying on ripgrep’s built-in types

echo "Searching for potential function calls that need updating..."
rg -A 3 "count_search_users|create_ai_chat|generate_cross_app_token" -g ".[jt]s" -g ".tsx" -g "*.jsx" || echo "No matches found"


</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@vhpx vhpx changed the title Feat scheduler db and functionality Add task support for calendar Jun 20, 2025
@vhpx vhpx marked this pull request as draft June 20, 2025 14:30
Copy link
Member

@vhpx vhpx left a comment

Choose a reason for hiding this comment

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

workspace_calendar_tasks (owned by workspaces) and tasks (owned by task_lists) should be merged. We will use tasks for everything task-related.

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: 3

♻️ Duplicate comments (3)
apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx (3)

43-44: Field names still inconsistent with their actual usage.

The field names suggest minutes but they store hours based on the UI labels "(h)" and step values (0.25). This creates confusion and should be addressed.

This was previously flagged but remains unaddressed. The field names min_split_duration_minutes and max_split_duration_minutes should be renamed to reflect that they store hours, not minutes.


100-102: Due date validation incomplete.

The current validation only checks if the due date is in the past but doesn't validate against the schedule_after date, which could lead to logical inconsistencies.

This validation gap was previously identified. The due date should also be validated to ensure it's not before the schedule_after date when both are provided.


134-139: Database field mapping uses incorrect field names.

The field names in the database submission still use "minutes" terminology while storing hour values, creating a mismatch between the database schema expectations and the actual data being stored.

-        min_split_duration_minutes: formData.is_splittable
-          ? formData.min_split_duration_minutes
-          : null,
-        max_split_duration_minutes: formData.is_splittable
-          ? formData.max_split_duration_minutes
-          : null,
+        min_split_duration_hours: formData.is_splittable
+          ? formData.min_split_duration_hours
+          : null,
+        max_split_duration_hours: formData.is_splittable
+          ? formData.max_split_duration_hours
+          : null,

This change requires coordinating with the database schema to ensure field names are consistent.

🧹 Nitpick comments (2)
apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx (1)

149-158: Add specific error handling for database constraints.

The current error handling is generic. Consider adding specific handling for common database constraint violations to provide more user-friendly error messages.

       if (error) {
         console.error('Database error:', error);
-        setErrors({ submit: `Failed to create task: ${error.message}` });
+        let errorMessage = 'Failed to create task';
+        if (error.code === '23503') {
+          errorMessage = 'Invalid workspace or user reference';
+        } else if (error.code === '23505') {
+          errorMessage = 'A task with this name already exists';
+        } else {
+          errorMessage = `Failed to create task: ${error.message}`;
+        }
+        setErrors({ submit: errorMessage });
         return false;
       }
apps/db/supabase/migrations/20250620145741_add_calendar_tasks_table.sql (1)

81-81: Inconsistent data type evolution for total_duration.

The migration first adds total_duration as text not null then immediately changes it to real. This suggests the data type choice wasn't finalized during development.

For cleaner migrations, consider consolidating these changes:

-alter table "public"."workspace_calendar_tasks" add column "total_duration" text not null;
-...
-alter table "public"."workspace_calendar_tasks" alter column "total_duration" set data type real using "total_duration"::real;
+alter table "public"."workspace_calendar_tasks" add column "total_duration" real not null;

This reduces migration complexity and potential issues.

Also applies to: 96-96

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 212dd3e and 540a5b9.

📒 Files selected for processing (5)
  • apps/db/supabase/migrations/20250620145741_add_calendar_tasks_table.sql (1 hunks)
  • apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/client.tsx (4 hunks)
  • apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-button.tsx (1 hunks)
  • apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx (1 hunks)
  • packages/types/src/supabase.ts (19 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-button.tsx
  • apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/client.tsx
  • packages/types/src/supabase.ts
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Verify generated types
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Prettier Check (23)
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
🔇 Additional comments (2)
apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx (1)

465-472: User email display properly implemented.

Good implementation of dynamic user email display that addresses the previous hardcoded email concern.

The fallback to "your account" when email is not available provides a good user experience.

apps/db/supabase/migrations/20250620145741_add_calendar_tasks_table.sql (1)

37-49: Consider restricting anonymous user permissions.

Granting full CRUD permissions to anonymous users (anon role) for calendar tasks may be overly permissive for this feature.

Please verify if anonymous users should have access to calendar tasks functionality, as this typically requires authentication.

#!/bin/bash
# Check if other calendar-related tables have similar anon permissions
rg -A 5 -B 5 "grant.*to.*anon" apps/db/supabase/migrations/ | grep -i calendar

Comment on lines +8 to +9
"ws_id" uuid,
"creator_id" uuid,
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Foreign key columns should be NOT NULL.

The ws_id and creator_id columns allow NULL values, but they have foreign key constraints and are essential for the application logic.

-    "ws_id" uuid,
-    "creator_id" uuid,
+    "ws_id" uuid not null,
+    "creator_id" uuid not null,

This prevents orphaned records and ensures data integrity.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"ws_id" uuid,
"creator_id" uuid,
"ws_id" uuid not null,
"creator_id" uuid not null,
🤖 Prompt for AI Agents
In apps/db/supabase/migrations/20250620145741_add_calendar_tasks_table.sql at
lines 8 to 9, the columns "ws_id" and "creator_id" are foreign keys but
currently allow NULL values. Modify these columns to be NOT NULL to enforce data
integrity and prevent orphaned records by updating their definitions to include
the NOT NULL constraint.

Comment on lines +89 to +94
create policy "allow only user in the workspace to insert"
on "public"."workspace_calendar_tasks"
as permissive
for insert
to authenticated
with check (true);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

RLS policy too permissive for workspace isolation.

The current policy allows any authenticated user to insert tasks with with check (true), which doesn't enforce workspace membership constraints.

This could allow users to create tasks in workspaces they don't belong to. Update the policy to check workspace membership:

 create policy "allow only user in the workspace to insert"
 on "public"."workspace_calendar_tasks"
 as permissive
 for insert
 to authenticated
-with check (true);
+with check (
+  exists (
+    select 1 from workspace_users 
+    where workspace_users.ws_id = workspace_calendar_tasks.ws_id 
+    and workspace_users.user_id = auth.uid()
+  )
+);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
create policy "allow only user in the workspace to insert"
on "public"."workspace_calendar_tasks"
as permissive
for insert
to authenticated
with check (true);
create policy "allow only user in the workspace to insert"
on "public"."workspace_calendar_tasks"
as permissive
for insert
to authenticated
with check (
exists (
select 1
from workspace_users
where workspace_users.ws_id = workspace_calendar_tasks.ws_id
and workspace_users.user_id = auth.uid()
)
);
🤖 Prompt for AI Agents
In apps/db/supabase/migrations/20250620145741_add_calendar_tasks_table.sql
around lines 89 to 94, the row-level security policy for inserting into
workspace_calendar_tasks is too permissive because it uses "with check (true)"
allowing any authenticated user to insert tasks regardless of workspace
membership. Modify the policy to include a condition in the "with check" clause
that verifies the user is a member of the workspace associated with the task,
ensuring only authorized users can insert tasks in their own workspaces.

@phatgg221 phatgg221 marked this pull request as ready for review June 21, 2025 17:20
@phatgg221 phatgg221 changed the title Add task support for calendar feat: Add task support for calendar Jun 21, 2025
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: 4

♻️ Duplicate comments (1)
packages/types/src/supabase.ts (1)

5170-5195: Foreign-key name still misspelled – migration will fail

The three foreignKeyName strings use workspace_calendar_taskss… (double s).
Same issue was flagged earlier but is still present, so the DDL generated from these types will not match the real constraint names produced by the migration.

-foreignKeyName: 'workspace_calendar_taskss_creator_id_fkey';
+foreignKeyName: 'workspace_calendar_tasks_creator_id_fkey';

Repeat for the other two occurrences (…_creator_id_fkey, …_ws_id_fkey).

🧹 Nitpick comments (4)
apps/db/supabase/migrations/20250621070438_alter_tasks_table.sql (4)

1-4: Use IF EXISTS when dropping policies to avoid failures on re-runs.

Wrapping DROP POLICY in IF EXISTS will make the migration idempotent and prevent errors if the policies have already been removed.


5-86: Consolidate repetitive REVOKE statements.

You can simplify these 48 REVOKE calls by using REVOKE ALL PRIVILEGES ON TABLE … FROM …; for each role. This will reduce verbosity and maintenance overhead.


131-133: Use DROP TABLE IF EXISTS (and CASCADE if needed).

Instead of DROP TABLE, consider:

DROP TABLE IF EXISTS public.workspace_calendar_sync_log CASCADE;
DROP TABLE IF EXISTS public.workspace_whiteboards CASCADE;

This avoids errors on repeated runs and automatically cleans up dependent objects.


135-145: Reevaluate the use of real for duration-related fields.

REAL is a low-precision floating type. For task durations you may prefer:

  • INTEGER (minutes)
  • INTERVAL (Postgres interval type)
  • NUMERIC(10,2) (fixed precision)

Choose based on required precision and unit.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 540a5b9 and 8981c08.

📒 Files selected for processing (6)
  • apps/db/supabase/migrations/20250621070438_alter_tasks_table.sql (1 hunks)
  • apps/db/supabase/migrations/20250621074218_new_migration.sql (1 hunks)
  • apps/db/supabase/migrations/20250621082137_new_migration.sql (1 hunks)
  • apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx (1 hunks)
  • apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/tasks-sidebar-content.tsx (1 hunks)
  • packages/types/src/supabase.ts (6 hunks)
🧰 Additional context used
🪛 GitHub Check: codecov/patch
apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx

[warning] 2-512: apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx#L2-L512
Added lines #L2 - L512 were not covered by tests

packages/types/src/supabase.ts

[warning] 8437-8437: packages/types/src/supabase.ts#L8437
Added line #L8437 was not covered by tests


[warning] 8442-8442: packages/types/src/supabase.ts#L8442
Added line #L8442 was not covered by tests

apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/tasks-sidebar-content.tsx

[warning] 237-242: apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/tasks-sidebar-content.tsx#L237-L242
Added lines #L237 - L242 were not covered by tests

🔇 Additional comments (8)
apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/tasks-sidebar-content.tsx (1)

237-242: LGTM! Proper initialization of new task properties.

The new properties are correctly initialized to null and align with the enhanced task schema for calendar functionality. The implementation follows the established pattern used for other optional fields in the same code block.

apps/db/supabase/migrations/20250621082137_new_migration.sql (1)

1-41: LGTM! Well-structured analytics view migration.

The migration properly drops and recreates the view with comprehensive analytics fields. The LEFT JOINs ensure data preservation when category or task information is missing, and the session length categorization thresholds are reasonable for analytics purposes.

apps/db/supabase/migrations/20250621074218_new_migration.sql (2)

9-9: LGTM! Supporting calendar tasks with nullable list_id.

Making list_id nullable is appropriate for calendar tasks that exist independently of traditional task boards. This change enables the calendar task functionality being added in this PR.


15-47: LGTM! Analytics view creation.

The view definition is comprehensive and well-structured for time tracking analytics.

apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx (1)

2-512: ```shell
#!/usr/bin/env bash

Search for any usage of AddEventModal across TypeScript files, including tests

echo "Searching for AddEventModal occurrences in .ts and .tsx files:"
rg -n "AddEventModal" -g ".ts" -g ".tsx" .


</details>
<details>
<summary>packages/types/src/supabase.ts (1)</summary>

`3642-3656`: **Making `list_id` nullable & adding split-task fields – double-check downstream code**

`tasks.list_id` is now optional/nullable and several new fields were added (`is_splittable`, `min/max_split_duration_hours`, *etc.*).  
Please verify:

1. All code paths that previously assumed a non-null `list_id` (e.g. joins, not-null checks in queries, UI routing) are guarded for `null`.
2. Business logic that reads/updates split-task fields is gated behind `is_splittable === true` to avoid inconsistent data.
3. Migrations add the new columns with correct defaults / not-null constraints.




Also applies to: 3666-3680, 3690-3704

</details>
<details>
<summary>apps/db/supabase/migrations/20250621070438_alter_tasks_table.sql (2)</summary>

`162-195`: **Verify analytics view coverage with new task fields.**

The `time_tracking_session_analytics` view isn’t selecting any of the newly added columns (`is_splittable`, `user_defined_priority`, etc.). Confirm if these should be surfaced in analytics or if a separate view is needed.

---

`198-210`: **Confirm removal of defaults / NOT NULL aligns with application logic.**

Dropping the defaults and null-constraints for `is_splittable`, `time_reference`, etc., will allow NULLs at insert time. Make sure that downstream application code handles NULL values correctly (and doesn’t rely on the old defaults).

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment on lines +55 to +67
React.useEffect(() => {
const getUser = async () => {
const {
data: { user },
error,
} = await supabase.auth.getUser();
if (!error && user) {
setUser(user);
}
};

getUser();
}, [supabase]);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling for user authentication.

The user fetch on mount doesn't handle potential errors or loading states, which could lead to poor UX if authentication fails.

  React.useEffect(() => {
    const getUser = async () => {
+     setIsLoading(true);
      const {
        data: { user },
        error,
      } = await supabase.auth.getUser();
-     if (!error && user) {
-       setUser(user);
-     }
+     if (error) {
+       console.error('Auth error:', error);
+       setErrors({ submit: 'Authentication failed. Please refresh and try again.' });
+     } else if (user) {
+       setUser(user);
+     }
+     setIsLoading(false);
    };

    getUser();
  }, [supabase]);

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx
around lines 55 to 67, the useEffect hook fetching the user does not handle
errors or loading states. To fix this, introduce state variables to track
loading and error status, update these states appropriately during the async
call, and handle the error case by setting an error state or displaying an error
message to improve user experience when authentication fails.

Comment on lines +99 to +101
if (formData.end_date && dayjs(formData.end_date).isBefore(dayjs())) {
newErrors.end_date = 'End date cannot be in the past';
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve date validation logic.

The current validation only checks if the end date is in the past, but should also validate that the end date comes after the start date when both are provided.

-    if (formData.end_date && dayjs(formData.end_date).isBefore(dayjs())) {
-      newErrors.end_date = 'End date cannot be in the past';
-    }
+    if (formData.end_date) {
+      const endDate = dayjs(formData.end_date);
+      if (endDate.isBefore(dayjs())) {
+        newErrors.end_date = 'End date cannot be in the past';
+      } else if (formData.start_date && endDate.isBefore(dayjs(formData.start_date))) {
+        newErrors.end_date = 'End date cannot be before the start date';
+      }
+    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (formData.end_date && dayjs(formData.end_date).isBefore(dayjs())) {
newErrors.end_date = 'End date cannot be in the past';
}
if (formData.end_date) {
const endDate = dayjs(formData.end_date);
if (endDate.isBefore(dayjs())) {
newErrors.end_date = 'End date cannot be in the past';
} else if (formData.start_date && endDate.isBefore(dayjs(formData.start_date))) {
newErrors.end_date = 'End date cannot be before the start date';
}
}
🤖 Prompt for AI Agents
In
apps/web/src/app/[locale]/(dashboard)/[wsId]/calendar/components/add-event-dialog.tsx
around lines 99 to 101, the date validation only checks if the end date is in
the past. Update the validation logic to also check if the end date is after the
start date when both start_date and end_date are provided. Add a condition to
compare the two dates and set an appropriate error message if the end date is
before or equal to the start date.

Comment on lines +150 to +153
CREATE UNIQUE INDEX workspace_calendar_taskss_pkey ON public.workspace_calendar_tasks USING btree (id);

alter table "public"."workspace_calendar_tasks" add constraint "workspace_calendar_taskss_pkey" PRIMARY KEY using index "workspace_calendar_taskss_pkey";

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Typo in index/constraint name: extra “s” in workspace_calendar_taskss_pkey.

You dropped and then recreated the PK index as workspace_calendar_taskss_pkey, but your table is workspace_calendar_tasks. This typo will cause confusion; rename it to workspace_calendar_tasks_pkey.

🤖 Prompt for AI Agents
In apps/db/supabase/migrations/20250621070438_alter_tasks_table.sql around lines
150 to 153, the index and constraint names have an extra "s" resulting in
"workspace_calendar_taskss_pkey". Rename both the unique index and the primary
key constraint to "workspace_calendar_tasks_pkey" to match the table name and
avoid confusion.

Comment on lines +154 to +160
alter table "public"."workspace_calendar_tasks" add constraint "workspace_calendar_taskss_creator_id_fkey" FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE CASCADE not valid;

alter table "public"."workspace_calendar_tasks" validate constraint "workspace_calendar_taskss_creator_id_fkey";

alter table "public"."workspace_calendar_tasks" add constraint "workspace_calendar_taskss_ws_id_fkey" FOREIGN KEY (ws_id) REFERENCES workspaces(id) ON DELETE CASCADE not valid;

alter table "public"."workspace_calendar_tasks" validate constraint "workspace_calendar_taskss_ws_id_fkey";
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Constraint names for FKs carry the same typo (“taskss”).

The foreign-key constraints are added as

  • workspace_calendar_taskss_creator_id_fkey
  • workspace_calendar_taskss_ws_id_fkey

Rename to use workspace_calendar_tasks_creator_id_fkey and workspace_calendar_tasks_ws_id_fkey for consistency.

🤖 Prompt for AI Agents
In apps/db/supabase/migrations/20250621070438_alter_tasks_table.sql around lines
154 to 160, the foreign key constraint names contain a typo with "taskss"
instead of "tasks". Rename the constraints from
"workspace_calendar_taskss_creator_id_fkey" to
"workspace_calendar_tasks_creator_id_fkey" and from
"workspace_calendar_taskss_ws_id_fkey" to "workspace_calendar_tasks_ws_id_fkey"
to correct the spelling and maintain consistency.

@vhpx vhpx changed the title feat: Add task support for calendar Add task support for calendar Jun 21, 2025
@vhpx vhpx marked this pull request as draft June 21, 2025 21:26
Copy link
Member

@vhpx vhpx left a comment

Choose a reason for hiding this comment

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

Please resolve build errors before changing the PR to ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants