Skip to content

Conversation

@elhalj
Copy link
Owner

@elhalj elhalj commented Oct 2, 2025

Summary by Sourcery

Fix user model and frontend type definitions to properly handle multiple comments and align preference field naming

Bug Fixes:

  • Change the user model’s comment property to an array of Comment object references instead of a single reference
  • Rename the preference type field from notification to notifications in the frontend user types

@elhalj elhalj added the bug Something isn't working label Oct 2, 2025
@netlify
Copy link

netlify bot commented Oct 2, 2025

Deploy Preview for colab-flow ready!

Name Link
🔨 Latest commit 8e37b46
🔍 Latest deploy log https://app.netlify.com/projects/colab-flow/deploys/68ddccdab01b2f0008c9893e
😎 Deploy Preview https://deploy-preview-36--colab-flow.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@sourcery-ai
Copy link

sourcery-ai bot commented Oct 2, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR addresses a bug in the user model by converting the comment field to an array of Comment ObjectIds and synchronizes the frontend type definitions by renaming the notification property to notifications in user preferences.

Entity Relationship diagram for updated User model 'comment' field

erDiagram
    USER {
        ObjectId id
        String name
        ...
        ObjectId[] comment
    }
    COMMENT {
        ObjectId id
        String text
        ...
    }
    USER ||--|{ COMMENT : "has comments"
Loading

Class diagram for updated Preference interface in frontend

classDiagram
    class NotificationProps {
        // properties as defined elsewhere
    }
    class Preference {
        NotificationProps notifications
        LanguageType language
        ThemeType theme
    }
    Preference --> NotificationProps
Loading

File-Level Changes

Change Details Files
Convert user.model comment field to support multiple comments
  • Changed comment type to an array of Comment ObjectIds
  • Set default value of comment field to an empty array
src/models/user.model.js
Rename notification property in user preference type
  • Renamed interface property from notification to notifications
frontend/src/types/user.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

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

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `frontend/src/types/user.ts:22` </location>
<code_context>
 type LanguageType = "fr" | "en" | "es";
 type ThemeType = "light" | "dark" | "system";
 export interface Preference {
-    notification?: NotificationProps;
+    notifications?: NotificationProps;
     language?: LanguageType;
     theme: ThemeType;
</code_context>

<issue_to_address>
**suggestion:** Check for consistency in naming: 'notifications' is now plural, but the type remains singular.

If 'notifications' refers to multiple items, update its type to NotificationProps[]. Otherwise, align the property name with the data structure.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

type LanguageType = "fr" | "en" | "es";
type ThemeType = "light" | "dark" | "system";
export interface Preference {
notification?: NotificationProps;
Copy link

Choose a reason for hiding this comment

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

suggestion: Check for consistency in naming: 'notifications' is now plural, but the type remains singular.

If 'notifications' refers to multiple items, update its type to NotificationProps[]. Otherwise, align the property name with the data structure.

@elhalj
Copy link
Owner Author

elhalj commented Oct 2, 2025

@sourcery-ai title

@sourcery-ai sourcery-ai bot changed the title fix bux in user model [comment] Fix user model comments and align frontend preferences Oct 2, 2025
@elhalj elhalj merged commit ba4f282 into main Oct 2, 2025
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants