Skip to content

feat: integrate GET API for watchlist tasks#115

Merged
iamitprakash merged 2 commits intodevelopfrom
feat/integrate-watchlist-task
Jul 16, 2025
Merged

feat: integrate GET API for watchlist tasks#115
iamitprakash merged 2 commits intodevelopfrom
feat/integrate-watchlist-task

Conversation

@MayankBansal12
Copy link
Member

@MayankBansal12 MayankBansal12 commented Jul 16, 2025

Date: 17-07-25

Developer Name: @MayankBansal12


Issue Ticket Number

Description

  • This PR integrates GET /watchlist/tasks API to show all watchlisted tasks for a user
  • Refactors data table to remove filtered watchlisted tasks

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

screencast
watchlist-task.mp4

Description by Korbit AI

What change is being made?

Integrate a GET API for fetching watchlist tasks and update associated components and types.

Why are these changes being made?

The change allows the fetching and display of tasks from a watchlist, addressing the need for users to view and manage their watchlist within the application's dashboard. This integration enhances user experience by organizing view-based data flow and updating component rendering.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

@MayankBansal12 MayankBansal12 self-assigned this Jul 16, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 16, 2025

Important

Review skipped

Auto incremental 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.

Summary by CodeRabbit

  • New Features
    • Added a dedicated table to display watchlist tasks in the dashboard.
    • Introduced a new API endpoint to fetch watchlist tasks.
  • Improvements
    • Enhanced the task data model for watchlist tasks with additional details and metadata.
    • Updated dashboard tabs to use a specialized component for watchlist tasks.
    • Improved task priority handling with numeric-to-enum mapping.
  • Bug Fixes
    • Ensured watchlist and general task lists update correctly after watchlist changes.

Walkthrough

A new API method and related types were added to support fetching watchlisted tasks. A dedicated React component was introduced to display watchlisted tasks, and dashboard components were refactored to use this new component. Task type definitions were expanded, and mapping utilities for task priority were added.

Changes

File(s) Change Summary
api/tasks/tasks.api.ts Added getWatchListTasks API method for fetching watchlist tasks.
api/tasks/tasks.enum.ts Introduced NUM_TASK_PRIORITY_TO_TASK_ENUM mapping numeric priorities to enum values.
api/tasks/tasks.types.ts Made assignee optional in TTask; added GetWatchListTaskDto and expanded TWatchListTask with new metadata fields.
modules/dashboard/components/dashboard-tabs.tsx Replaced watchlist tab content with new DashboardWatchlistTasksTable component; cleaned up unused imports and props.
modules/dashboard/components/dashboard-tasks-table.tsx Removed filtering logic and type prop; now renders all tasks passed; added query invalidation for watchlist tasks.
modules/dashboard/components/dashboard-watchlist-tasks-table.tsx Added new component to fetch and display watchlisted tasks using the new API method and types.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DashboardTabs
    participant DashboardWatchlistTasksTable
    participant TasksApi
    participant Backend

    User->>DashboardTabs: Selects "WatchList" tab
    DashboardTabs->>DashboardWatchlistTasksTable: Render component
    DashboardWatchlistTasksTable->>TasksApi: getWatchListTasks()
    TasksApi->>Backend: GET /v1/watchlist/tasks
    Backend-->>TasksApi: Responds with watchlisted tasks
    TasksApi-->>DashboardWatchlistTasksTable: Returns tasks data
    DashboardWatchlistTasksTable->>DashboardTasksTable: Render with formatted watchlist tasks
Loading

Assessment against linked issues

Objective (Issue) Addressed Explanation
Integrate GET /watchlist/tasks API to allow users to view all watchlisted tasks (#112)
Add components to allow users to view all their watchlisted tasks (#112)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Possibly related issues

Possibly related PRs

Suggested reviewers

  • amit-flx

Poem

A watchlist grows with tasks anew,
Now fetched and shown for every view.
Tabs refreshed, components bright,
Priorities mapped—just right!
🐇 The dashboard hops with glee—
"Your watchlist tasks, now clear to see!"


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

@korbit-ai korbit-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.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Performance Inefficient Data Passing to Watchlist Component ▹ view
Readability Missing Query Response Type ▹ view
Error Handling Missing Error Context in Error Handling ▹ view
Performance Missing Pagination Parameters ▹ view
Functionality Inconsistent Priority Type in TWatchListTask ▹ view
Functionality Unnecessary Nullable Boolean ▹ view
Files scanned
File Path Reviewed
api/tasks/tasks.enum.ts
api/tasks/tasks.api.ts
api/tasks/tasks.types.ts
modules/dashboard/components/dashboard-watchlist-tasks-table.tsx
modules/dashboard/components/dashboard-tabs.tsx
modules/dashboard/components/dashboard-tasks-table.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Copy link

@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: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03bb795 and 1a12c8e.

📒 Files selected for processing (6)
  • api/tasks/tasks.api.ts (2 hunks)
  • api/tasks/tasks.enum.ts (1 hunks)
  • api/tasks/tasks.types.ts (3 hunks)
  • modules/dashboard/components/dashboard-tabs.tsx (2 hunks)
  • modules/dashboard/components/dashboard-tasks-table.tsx (4 hunks)
  • modules/dashboard/components/dashboard-watchlist-tasks-table.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Hariom01010
PR: Real-Dev-Squad/todo-frontend#51
File: __mocks__/types.ts:33-34
Timestamp: 2025-07-09T08:59:13.002Z
Learning: In the todo-frontend project, the PATCH task API endpoint payload uses `dueAt` and `startedAt` field names, but these update the `dueDate` and `startDate` fields respectively in the Task object. This is intentional according to the API contract design.
api/tasks/tasks.types.ts (1)
Learnt from: Hariom01010
PR: Real-Dev-Squad/todo-frontend#51
File: __mocks__/types.ts:33-34
Timestamp: 2025-07-09T08:59:13.002Z
Learning: In the todo-frontend project, the PATCH task API endpoint payload uses `dueAt` and `startedAt` field names, but these update the `dueDate` and `startDate` fields respectively in the Task object. This is intentional according to the API contract design.
🔇 Additional comments (17)
api/tasks/tasks.enum.ts (1)

25-29: Good addition for priority mapping.

The numeric-to-enum mapping is correctly implemented and follows a logical progression. The constant will help convert API response data to internal enum format.

api/tasks/tasks.api.ts (2)

11-11: Import added for new watchlist API method.

The import is correctly added to support the new getWatchListTasks method.


38-44: Well-implemented API method following established patterns.

The new getWatchListTasks method correctly follows the same structure as other API methods in the file, with proper typing and endpoint configuration.

modules/dashboard/components/dashboard-tabs.tsx (4)

3-3: Good cleanup of unused imports.

Removing unused imports improves code maintainability and reduces bundle size.


9-9: Appropriate import for the new watchlist component.

The dedicated watchlist component import is correctly added.


44-44: Simplified DashboardTasksTable usage.

Removing the type prop aligns with the refactoring to separate watchlist and general task handling.


47-47: Proper separation of concerns with dedicated watchlist component.

Using DashboardWatchlistTasksTable for the watchlist tab is a good architectural decision that separates concerns and improves maintainability.

modules/dashboard/components/dashboard-tasks-table.tsx (4)

101-101: Good addition of query invalidation for data consistency.

Adding invalidation for the getWatchListTasks query ensures that watchlist data stays synchronized after mutations.


113-113: Consistent query invalidation pattern.

Properly invalidating both queries maintains data consistency across the application.


145-145: Simplified component interface.

Removing the type prop simplifies the component interface and aligns with the separation of concerns achieved by introducing the dedicated watchlist component.


162-162: Simplified rendering logic.

Removing filtering logic makes the component more focused and easier to understand, as watchlist-specific rendering is now handled by the dedicated component.

modules/dashboard/components/dashboard-watchlist-tasks-table.tsx (3)

1-9: Well-structured imports and component setup.

The imports are appropriate and the component is well-structured for handling watchlist tasks.


11-16: Proper API integration with React Query.

The useQuery implementation correctly uses the new API method and follows React Query best practices.


17-31: Comprehensive state handling.

The component properly handles loading, error, and empty states with appropriate UI feedback.

api/tasks/tasks.types.ts (3)

10-10: LGTM: Making assignee optional is appropriate.

This change aligns with the typical scenario where tasks may not always have an assignee at creation time or in certain contexts like watchlisted tasks.


43-48: LGTM: Well-structured paginated response type.

The GetWatchListTaskDto follows the same pagination pattern as GetTasksDto, maintaining consistency across the API response types.


59-74: No changes required: Priority mapping is in place

  • The numeric priority?: number in TWatchListTask is correctly converted to TASK_PRIORITY_ENUM in
    modules/dashboard/components/dashboard-watchlist-tasks-table.tsx via
    NUM_TASK_PRIORITY_TO_TASK_ENUM[task.priority ?? 0].
  • Field naming (dueAt) and nullable booleans (isAcknowledged, isDeleted) are already aligned with API responses.

Everything looks consistent and comprehensive.

@iamitprakash iamitprakash merged commit ad1fdad into develop Jul 16, 2025
3 checks passed
@iamitprakash iamitprakash deleted the feat/integrate-watchlist-task branch July 16, 2025 20:40
@coderabbitai coderabbitai bot mentioned this pull request Aug 13, 2025
10 tasks
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.

feat: integrate API to view all watchlisted tasks for a user

2 participants