Skip to content
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

feat(api): Workspace-membership invitationAccepted included #665

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

csehatt741
Copy link
Contributor

@csehatt741 csehatt741 commented Jan 25, 2025

User description

Description

WorkspaceMember.invitationAccepted returned in /api/workspace-membership/{workspaceSlug}/members

Fixes #406

Screenshots of relevant screens

image

Developer's checklist

  • My PR follows the style guidelines of this project
  • I have performed a self-check on my work

If changes are made in the code:

  • I have followed the coding guidelines
  • My changes in code generate no new warnings
  • My changes are breaking another fix/feature of the project
  • I have added test cases to show that my feature works
  • I have added relevant screenshots in my PR
  • There are no UI/UX issues

Documentation Update

  • This PR requires an update to the documentation at docs.keyshade.xyz
  • I have made the necessary updates to the documentation, or no documentation changes are required.

PR Type

Enhancement


Description

  • Added invitationAccepted field to workspace membership API response.

  • Enhanced /api/workspace/{workspaceId}/members endpoint to include membership status.

  • Updated service logic to fetch and return invitation status.

  • Improved API functionality for better workspace member management.


Changes walkthrough 📝

Relevant files
Enhancement
workspace-membership.service.ts
Include invitation status in workspace membership API       

apps/api/src/workspace-membership/service/workspace-membership.service.ts

  • Added invitationAccepted field to the API response.
  • Enhanced query to include invitation status in the returned data.
  • +2/-1     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    🎫 Ticket compliance analysis 🔶

    406 - Partially compliant

    Compliant requirements:

    • Add 'active' field to endpoint response (implemented as 'invitationAccepted')
    • Update service function to fetch invitation status

    Non-compliant requirements:

    • Include tests for the changes

    Requires further human verification:

    • Verify that invitationAccepted field correctly reflects the invitation status in API responses
    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Missing Tests

    The PR adds new functionality but lacks test coverage to verify the invitation status is correctly returned

    invitationAccepted: true

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    General
    Add null check for data integrity

    Consider adding a null check for the invitationAccepted field in the query to handle
    cases where the invitation status might not be set.

    apps/api/src/workspace-membership/service/workspace-membership.service.ts [520]

    -invitationAccepted: true
    +invitationAccepted: {
    +  select: true,
    +  where: {
    +    NOT: null
    +  }
    +}
    • Apply this suggestion
    Suggestion importance[1-10]: 3

    Why: While adding a null check could provide additional data validation, the current implementation using 'true' is a standard Prisma select statement and is sufficient for most use cases. The suggestion adds unnecessary complexity without significant benefit.

    3

    @csehatt741 csehatt741 force-pushed the workspace-membershipAccepted branch from 192746f to 77d69cf Compare January 25, 2025 14:54
    @@ -516,7 +516,8 @@ export class WorkspaceMembershipService {
    }
    }
    }
    }
    },
    invitationAccepted: true
    Copy link
    Member

    Choose a reason for hiding this comment

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

    Can't always be true. This should come from the invitation status field in workspace membership model

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    invitationAccepted: true is how Prisma configured to include a specific field in the return type.

    Copy link
    Member

    Choose a reason for hiding this comment

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

    I need to get my eyes checked. Sorry :)

    Copy link
    Member

    Choose a reason for hiding this comment

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

    Just the tests would work

    @rajdip-b
    Copy link
    Member

    Also, could you add relevant tests for this?

    @csehatt741
    Copy link
    Contributor Author

    This week I'm off. Next week I'll sort out this and all other issues too.

    @rajdip-b
    Copy link
    Member

    Thanks!

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

    Successfully merging this pull request may close these issues.

    API: Display membership status while fetching workspace members
    2 participants