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: User tags backend adjustments (GSoC) #2460

Merged
merged 8 commits into from
Aug 15, 2024

Conversation

meetulr
Copy link
Contributor

@meetulr meetulr commented Aug 15, 2024

What kind of change does this PR introduce?

Makes backend adjustments required for implementing tag screens in the admin.

Issue Number:

Fixes #2459

Did you add tests for your changes?

Yes

Does this PR introduce a breaking change?

No

Additional Context

Admin issue: PalisadoesFoundation/talawa-admin#2037

Summary by CodeRabbit

  • New Features

    • Enhanced user tag assignment to now include all ancestor tags.
    • Improved unassignment functionality to manage child tags effectively.
    • Introduced new queries to fetch user tags and their ancestors.
  • Bug Fixes

    • Resolved issues with input structure for tag updates, changing _id to tagId.
    • Updated tag retrieval logic to ensure correct filtering based on parent tags.
  • Tests

    • Added comprehensive test cases for new and updated mutation and query resolvers, ensuring robustness in functionality.
    • Introduced unit tests for the new getUserTag and getUserTagAncestors resolvers.

Copy link

coderabbitai bot commented Aug 15, 2024

Walkthrough

The recent changes introduce new GraphQL resolvers and enhancements to existing ones for improved management of user tags. These modifications allow for hierarchical tag assignment and unassignment, enabling better organization of tags. Additionally, new queries have been added to retrieve individual tags and their ancestry. Overall, these adjustments enhance the efficiency and robustness of the tagging system within the application.

Changes

Files Change Summary
src/resolvers/Mutation/*.ts Updated assignUserTag and unassignUserTag to manage hierarchical tag structures. Renamed identifier in updateUserTag, and added new resolvers for tag retrieval.
src/resolvers/Query/*.ts Introduced getUserTag and getUserTagAncestors to fetch specific tags and their relationships.
src/typeDefs/*.ts Modified input types and query definitions to reflect new tag management features, and adjusted data types for connections.
src/types/generatedGraphQLTypes.ts Updated type definitions to include new queries and fields relevant to the tagging system.
tests/**/*.spec.ts Expanded test coverage for new and updated resolvers, ensuring proper functionality and error handling in the user tag management system.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant API
    participant DB

    User->>API: assignUserTag(tagId)
    activate API
    API->>DB: findAllAncestorTags(tagId)
    DB-->>API: return ancestorTags
    API->>DB: bulkWrite(assignments)
    DB-->>API: success
    API-->>User: success response

    User->>API: unassignUserTag(tagId)
    activate API
    API->>DB: findAllChildTags(tagId)
    DB-->>API: return childTags
    API->>DB: deleteMany(relatedAssignments)
    DB-->>API: success
    API-->>User: success response
Loading

Assessment against linked issues

Objective Addressed Explanation
Introduce new resolvers for tag management (2459)
Enhance existing tag assignment functionality (2459)
Improve hierarchical tag retrieval (2459)
Modify input types for better clarity (2459)
Ensure comprehensive test coverage for new features

Poem

🐰 In a forest of tags, bright and neat,
A rabbit hops fast on soft, furry feet.
With each user tagged, a new tale unfolds,
Hierarchies dance, as the story is told.
Cheers to the changes, so clever and spry,
In the world of tags, we reach for the sky! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @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.

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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

@meetulr meetulr changed the title feat: User tags backend adjustments feat: User tags backend adjustments (GSoC) Aug 15, 2024
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: 5

Outside diff range, codebase verification and nitpick comments (5)
src/resolvers/Query/getUserTag.ts (1)

6-21: Ensure comprehensive error handling for database operations.

The search results indicate that try-catch blocks are primarily found in test files and utility scripts. There is no evidence of comprehensive error handling in the main application code, particularly in the getUserTag function. Consider adding try-catch blocks around database operations to handle potential connection issues or other database-related errors.

  • Location to update:
    • src/resolvers/Query/getUserTag.ts: Add error handling for database operations.
Analysis chain

Ensure comprehensive error handling.

The getUserTag function correctly handles the case where a tag is not found. However, consider handling potential database errors, such as connection issues, to improve robustness.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify error handling for database operations in the codebase.

# Test: Search for error handling in database operations. Expect: Comprehensive error handling.
rg --type javascript -A 5 $'catch'

Length of output: 68


Script:

#!/bin/bash
# Description: Verify error handling for database operations in the codebase.

# Test: Search for error handling in database operations. Expect: Comprehensive error handling.
rg 'try\s*{'

Length of output: 92


Script:

#!/bin/bash
# Description: Verify error handling for database operations in the codebase.

# Test: Search for error handling in database operations. Expect: Comprehensive error handling.
rg 'try\s*\{'

Length of output: 39469

src/resolvers/Query/getUserTagAncestors.ts (1)

6-31: Enhance Error Handling and Loop Logic in getUserTagAncestors Function

The getUserTagAncestors function lacks explicit error handling for database operations, which could lead to unhandled exceptions. Additionally, ensure the loop has safeguards against potential infinite loops due to inconsistent data.

  • Consider wrapping database calls in try-catch blocks to handle potential errors.
  • Review the loop logic to ensure it terminates correctly, especially in cases of data inconsistency.
Analysis chain

Consider optimizing error handling and loop logic.

The getUserTagAncestors function correctly retrieves ancestors but could benefit from handling potential database errors. Additionally, ensure the loop terminates correctly to avoid infinite loops if data is inconsistent.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify error handling and loop termination in the codebase.

# Test: Search for error handling in loops and database operations. Expect: Proper error handling and loop termination.
rg --type javascript -A 5 $'catch'

Length of output: 68


Script:

#!/bin/bash
# Search for try-catch blocks in the getUserTagAncestors function to check error handling.
ast-grep --lang typescript --pattern $'async $_($_, $_) {
  try {
    $$$
  } catch ($_){
    $$$
  }
}' --json

# Check for any comments or annotations related to error handling or loop termination in the file.
rg --type ts -C 3 'error|loop|termination' src/resolvers/Query/getUserTagAncestors.ts

Length of output: 1105

tests/resolvers/Query/getUserTag.spec.ts (1)

13-13: Optimize import for type-only usage.

The TestUserTagType is used only as a type. Consider using TypeScript's import type syntax for clarity.

- import {
-   createRootTagWithOrg,
-   createTwoLevelTagsWithOrg,
-   TestUserTagType,
- } from "../../helpers/tags";
+ import type { TestUserTagType } from "../../helpers/tags";
+ import { createRootTagWithOrg } from "../../helpers/tags";
Tools
GitHub Check: Check for linting, formatting, and type errors

[failure] 13-13:
Imports "TestUserTagType" are only used as type

tests/resolvers/Query/getUserTagAncestors.spec.ts (1)

9-9: Use type-only import for TestUserTagType.

The TestUserTagType import is only used as a type and should be imported as such to follow TypeScript best practices.

- import { createTwoLevelTagsWithOrg, TestUserTagType } from "../../helpers/tags";
+ import { createTwoLevelTagsWithOrg } from "../../helpers/tags";
+ import type { TestUserTagType } from "../../helpers/tags";
Tools
GitHub Check: Check for linting, formatting, and type errors

[failure] 9-9:
Imports "TestUserTagType" are only used as type

src/resolvers/Mutation/assignUserTag.ts (1)

171-180: Consider Adding Error Handling for bulkWrite Operation

The bulkWrite operation does not appear to have explicit error handling in src/resolvers/Mutation/assignUserTag.ts. It is advisable to wrap this operation in a try-catch block to handle potential errors effectively, ensuring the robustness of the application.

  • Consider wrapping the bulkWrite call in a try-catch block.
  • Implement appropriate error handling or logging within the catch block.
Analysis chain

LGTM! Verify the structure of bulk operations in bulkWrite.

The use of bulkWrite is efficient for batch processing. Ensure that the operations are correctly structured and handle potential errors.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the structure of bulk operations in `bulkWrite`.

# Test: Search for `bulkWrite` usage and check for proper error handling.
rg --type ts 'bulkWrite' src/resolvers/Mutation/assignUserTag.ts

Length of output: 104


Script:

#!/bin/bash
# Description: Check for error handling related to `bulkWrite` in the same file.

# Search for try-catch blocks or error handling mechanisms in the file.
rg --type ts 'try|catch|error' src/resolvers/Mutation/assignUserTag.ts

Length of output: 394

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 10a5203 and c1ea23c.

Files selected for processing (16)
  • src/resolvers/Mutation/assignUserTag.ts (1 hunks)
  • src/resolvers/Mutation/unassignUserTag.ts (1 hunks)
  • src/resolvers/Mutation/updateUserTag.ts (2 hunks)
  • src/resolvers/Organization/userTags.ts (1 hunks)
  • src/resolvers/Query/getUserTag.ts (1 hunks)
  • src/resolvers/Query/getUserTagAncestors.ts (1 hunks)
  • src/resolvers/Query/index.ts (2 hunks)
  • src/typeDefs/inputs.ts (1 hunks)
  • src/typeDefs/queries.ts (1 hunks)
  • src/typeDefs/types.ts (2 hunks)
  • src/types/generatedGraphQLTypes.ts (8 hunks)
  • tests/resolvers/Mutation/assignUserTag.spec.ts (3 hunks)
  • tests/resolvers/Mutation/unassignUserTag.spec.ts (2 hunks)
  • tests/resolvers/Mutation/updateUserTag.spec.ts (6 hunks)
  • tests/resolvers/Query/getUserTag.spec.ts (1 hunks)
  • tests/resolvers/Query/getUserTagAncestors.spec.ts (1 hunks)
Additional context used
GitHub Check: Check for linting, formatting, and type errors
tests/resolvers/Query/getUserTag.spec.ts

[failure] 8-8:
'QueryGetUserTagAncestorsArgs' is defined but never used


[failure] 12-12:
'TestUserType' is defined but never used


[failure] 13-13:
Imports "TestUserTagType" are only used as type


[failure] 15-15:
'createTwoLevelTagsWithOrg' is defined but never used

tests/resolvers/Query/getUserTagAncestors.spec.ts

[failure] 9-9:
Imports "TestUserTagType" are only used as type

tests/resolvers/Mutation/unassignUserTag.spec.ts

[failure] 33-33:
'testSubTag2' is assigned a value but never used

tests/resolvers/Mutation/assignUserTag.spec.ts

[failure] 38-38:
'testSubTag1' is assigned a value but never used

Additional comments not posted (28)
tests/resolvers/Query/getUserTagAncestors.spec.ts (3)

17-24: Setup and teardown are correctly implemented.

The beforeAll and afterAll functions ensure proper database connection management.


26-46: First test case is well-structured.

The test correctly verifies that a NotFoundError is thrown for a non-existent tag ID and mocks the translation function.


48-60: Second test case is correctly implemented.

The test accurately verifies the functionality of retrieving ancestor tags.

src/resolvers/Query/index.ts (2)

37-38: Import statements are correctly structured.

The new resolvers getUserTag and getUserTagAncestors are appropriately included.


89-90: Export statements are correctly integrated.

The new resolvers are correctly added to the Query export, enhancing the API's functionality.

src/typeDefs/queries.ts (1)

128-130: New query definitions are correctly structured.

The getUserTag and getUserTagAncestors queries are well-defined and enhance the API's data retrieval capabilities.

src/resolvers/Mutation/updateUserTag.ts (2)

133-134: LGTM! Verify consistent usage of args.input.tagId.

The change to use args.input.tagId for updating the tag is appropriate. Ensure this identifier is consistently used throughout the codebase.


77-78: LGTM! Verify consistent usage of args.input.tagId.

The change to use args.input.tagId for retrieving the tag is appropriate. Ensure this identifier is consistently used throughout the codebase.

Verification successful

Consistent Usage of args.input.tagId Verified

The identifier args.input.tagId is used consistently for tag retrieval within the file. Other instances of _id are contextually distinct and appropriately used for different purposes. No further changes are needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistent usage of `args.input.tagId` in the file.

# Test: Search for `args.input.tagId` usage. Expect: Consistent usage throughout the file.
rg --type ts 'args\.input\.tagId' src/resolvers/Mutation/updateUserTag.ts

Length of output: 131


Script:

#!/bin/bash
# Description: Check for any remaining usage of `_id` that might need updating.

# Test: Search for `_id` usage. Expect: No remaining usage related to the old identifier.
rg --type ts '_id' src/resolvers/Mutation/updateUserTag.ts

Length of output: 172

src/resolvers/Organization/userTags.ts (1)

75-76: LGTM! Verify the impact of the parentTagId: null filter.

The addition of parentTagId: null ensures that only top-level tags are fetched. Verify that this aligns with the expected data retrieval requirements.

src/resolvers/Mutation/assignUserTag.ts (2)

155-167: LGTM! Verify handling of edge cases in ancestor tag collection.

The logic for collecting ancestor tags is sound. Ensure that the loop properly handles cases with null parentTagId and avoids circular references.


180-181: LGTM! Verify completeness of the returned requestUser.

Returning the requestUser is appropriate. Ensure that the returned object includes all necessary information for subsequent operations.

Verification successful

To verify the completeness of the requestUser, we need to check the User model to understand what fields are included when findOne is called. This will help ensure that requestUser contains all necessary information for subsequent operations.


To verify the completeness of the requestUser, we need to inspect the User model in src/models/User.ts to understand its structure and fields.


The requestUser appears to be complete and includes necessary fields.

The requestUser is based on the User model, which includes comprehensive fields such as joinedOrganizations, email, address, and more. This ensures that the returned user object is complete for subsequent operations.

  • The User model is structured with a detailed interface and schema, ensuring all relevant user information is included.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify completeness of the returned `requestUser`.

# Test: Search for `requestUser` usage to ensure it includes necessary fields.
rg --type ts 'requestUser' src/resolvers/Mutation/assignUserTag.ts

Length of output: 304


Script:

#!/bin/bash
# Description: Check the User model to verify fields included in the requestUser.

# Find the User model definition to inspect its fields.
fd -e ts User

# Once found, extract the fields defined in the User model.
ast-grep --lang typescript --pattern 'class User { $$$ }' --json

Length of output: 3562


Script:

#!/bin/bash
# Description: Inspect the User model to verify its structure and fields.

# Search for the User model structure in the file to understand its fields.
rg --type ts 'User' src/models/User.ts -A 20

Length of output: 2831

src/resolvers/Mutation/unassignUserTag.ts (1)

148-177: Efficient handling of nested tags.

The changes efficiently handle nested tag structures by retrieving all child tags and using deleteMany for unassignment. This approach reduces the number of database queries and optimizes performance. However, consider testing the performance impact with large tag hierarchies to ensure scalability.

tests/resolvers/Mutation/updateUserTag.spec.ts (1)

63-63: Improved clarity in test input structure.

The replacement of _id with tagId in the test cases enhances readability and aligns with the mutation's purpose. Ensure that this change is consistently applied throughout the codebase to maintain uniformity.

Also applies to: 95-95, 128-128, 165-165, 201-201, 229-229

tests/resolvers/Mutation/unassignUserTag.spec.ts (1)

250-298: Comprehensive test for cascading unassignment.

The new test case effectively verifies the unassignment of all child and descendant tags when a parent tag is unassigned. This ensures the cascading unassignment logic is correctly implemented and robustly tested.

tests/resolvers/Mutation/assignUserTag.spec.ts (4)

25-28: LGTM on imports and variable declarations.

The new imports and variables are appropriate for the test enhancements.

Also applies to: 35-39


44-46: LGTM on beforeAll setup changes.

The setup correctly initializes two-level tags and a new admin user for testing.


222-245: LGTM on successful tag assignment test.

The test correctly verifies that the tag is assigned and the correct user is returned.


Line range hint 247-276: LGTM on ancestor tag assignment test.

The test correctly verifies that both the sub-tag and ancestor tags are assigned.

src/typeDefs/inputs.ts (1)

493-494: LGTM on UpdateUserTagInput changes.

Renaming _id to tagId improves clarity, and making tagColor nullable adds flexibility.

src/typeDefs/types.ts (1)

745-745: LGTM on totalCount field changes.

Changing totalCount to Int in UserTagsConnection and adding it to UsersConnection enhances flexibility and functionality.

Also applies to: 762-762

src/types/generatedGraphQLTypes.ts (8)

2309-2309: Addition of getUserTag field is correct.

The new getUserTag field in the Query type is properly defined as optional, following GraphQL best practices.


2310-2310: Addition of getUserTagAncestors field is correct.

The new getUserTagAncestors field in the Query type is correctly defined to handle nullable values, enhancing robustness.


2526-2528: Addition of QueryGetUserTagArgs type is correct.

The QueryGetUserTagArgs type is properly defined with an id argument, aligning with GraphQL conventions.


2531-2533: Addition of QueryGetUserTagAncestorsArgs type is correct.

The QueryGetUserTagAncestorsArgs type is properly defined with an id argument, aligning with GraphQL conventions.


2924-2924: Modification of tagColor field to optional is correct.

Changing the tagColor field to optional in UpdateUserTagInput provides greater flexibility for updates.


2925-2925: Addition of tagId field is correct.

The tagId field in UpdateUserTagInput is necessary for associating updates with specific tags, ensuring accuracy.


3099-3099: Modification of totalCount field in UserTagsConnection is correct.

Changing totalCount to a nullable integer enhances flexibility and aligns with GraphQL best practices.


3148-3148: Modification of totalCount field in UsersConnection is correct.

Changing totalCount to a nullable integer enhances flexibility and aligns with GraphQL best practices.

tests/resolvers/Mutation/unassignUserTag.spec.ts Outdated Show resolved Hide resolved
tests/resolvers/Query/getUserTag.spec.ts Outdated Show resolved Hide resolved
tests/resolvers/Query/getUserTag.spec.ts Outdated Show resolved Hide resolved
tests/resolvers/Query/getUserTag.spec.ts Outdated Show resolved Hide resolved
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.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c1ea23c and b0e898b.

Files selected for processing (5)
  • schema.graphql (4 hunks)
  • tests/resolvers/Mutation/assignUserTag.spec.ts (3 hunks)
  • tests/resolvers/Mutation/unassignUserTag.spec.ts (2 hunks)
  • tests/resolvers/Query/getUserTag.spec.ts (1 hunks)
  • tests/resolvers/Query/getUserTagAncestors.spec.ts (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • tests/resolvers/Query/getUserTag.spec.ts
  • tests/resolvers/Query/getUserTagAncestors.spec.ts
Additional comments not posted (20)
tests/resolvers/Mutation/unassignUserTag.spec.ts (7)

Line range hint 57-77:
LGTM!

The test case correctly verifies the NotFoundError when no user exists with the given context user ID.


Line range hint 87-107:
LGTM!

The test case correctly verifies the NotFoundError when no user exists with the given input user ID.


Line range hint 117-137:
LGTM!

The test case correctly verifies the NotFoundError when no tag exists with the given tag ID.


Line range hint 147-167:
LGTM!

The test case correctly verifies the Not Authorized Error when the current user is not authorized to unassign the tag.


Line range hint 177-197:
LGTM!

The test case correctly verifies the USER_DOES_NOT_HAVE_THE_TAG error when the user does not have the tag.


Line range hint 207-243:
LGTM!

The test case correctly verifies successful tag unassignment and ensures the user is returned.


249-295: LGTM!

The test case correctly verifies the unassignment of all child and descendant tags when a parent tag is unassigned.

tests/resolvers/Mutation/assignUserTag.spec.ts (8)

Line range hint 57-77:
LGTM!

The test case correctly verifies the NotFoundError when no user exists with the given context user ID.


Line range hint 87-107:
LGTM!

The test case correctly verifies the NotFoundError when no user exists with the given input user ID.


Line range hint 117-137:
LGTM!

The test case correctly verifies the NotFoundError when no tag exists with the given tag ID.


Line range hint 147-167:
LGTM!

The test case correctly verifies the Not Authorized Error when the current user is not authorized to assign the tag.


Line range hint 177-197:
LGTM!

The test case correctly verifies the error when the user is not a member of the organization of the tag being assigned.


220-243: LGTM!

The test case correctly verifies successful tag assignment and ensures the user is returned.


Line range hint 245-274:
LGTM!

The test case correctly verifies the assignment of all ancestor tags when a sub-tag is assigned.


Line range hint 276-296:
LGTM!

The test case correctly verifies the USER_ALREADY_HAS_TAG error when a tag is already assigned to the user.

schema.graphql (5)

1517-1517: LGTM!

The getUserTag query is correctly defined to retrieve a user tag by ID.


1518-1518: LGTM!

The getUserTagAncestors query is correctly defined to retrieve ancestor tags by ID.


1805-1806: LGTM!

The changes to UpdateUserTagInput enhance flexibility by making tagColor optional and adding tagId for specific identification.


1944-1944: LGTM!

The change to totalCount in UserTagsConnection broadens the range of values it can represent, which is appropriate.


1992-1992: LGTM!

The addition of totalCount to UsersConnection provides valuable metadata about the connection.

Copy link

codecov bot commented Aug 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.40%. Comparing base (10a5203) to head (b0e898b).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff            @@
##           develop    #2460    +/-   ##
=========================================
  Coverage    98.40%   98.40%            
=========================================
  Files          355      357     +2     
  Lines        28350    28453   +103     
  Branches      2388     2400    +12     
=========================================
+ Hits         27897    28000   +103     
  Misses         450      450            
  Partials         3        3            

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

@palisadoes palisadoes merged commit db3d2f5 into PalisadoesFoundation:develop Aug 15, 2024
10 of 11 checks passed
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