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

Added Sample Data For AgendaCategory & Removed Delete Fund/Campaign Mutations #2511

Merged

Conversation

GlenDsza
Copy link
Contributor

@GlenDsza GlenDsza commented Sep 7, 2024

What kind of change does this PR introduce?

refactoring

Issue Number:

Fixes #2510

Did you add tests for your changes?

Yes

Snapshots/Videos:

Default agendaCategories being created on importing sample data

image

Summary

  • Added Sample Data (Default category) for AgendaCategories for each organization
  • Removed RemoveFund Mutation
  • Removed RemoveFundraisingCampaign Mutation

Does this PR introduce a breaking change?

No

Have you read the contributing guide?

Yes

Summary by CodeRabbit

  • New Features

    • Introduced a new JSON file for action item categories, providing default templates for better task organization.
  • Bug Fixes

    • Removed outdated mutation operations for removing funds and fundraising campaigns, streamlining API functionality.
  • Chores

    • Enhanced data handling capabilities by integrating support for agenda categories in the database operations.
  • Tests

    • Added unit tests for error handling related to input validation and invalid file types, ensuring robustness in error management.
    • Introduced tests for the forgotPassword mutation to validate handling of invalid OTP scenarios.

Copy link

coderabbitai bot commented Sep 7, 2024

Walkthrough

This update introduces a new JSON file for agenda categories, enhancing sample data for better user experience. It also removes two mutation operations related to deleting funds and fundraising campaigns from the GraphQL schema and resolvers, reflecting a shift in functionality. Additionally, modifications are made to the data loading utilities to accommodate the new agenda category model.

Changes

Files Change Summary
sample_data/agendaCategories.json Added a new JSON file containing default action item categories with relevant properties.
schema.graphql, src/resolvers/Mutation/index.ts, src/typeDefs/mutations.ts, src/types/generatedGraphQLTypes.ts Removed removeFund and removeFundraisingCampaign mutations from the GraphQL schema and resolvers.
src/utilities/loadSampleData.ts Updated to support the new AgendaCategoryModel, including data management functions for categories.
src/resolvers/Mutation/forgotPassword.ts Modified error handling logic in the forgotPassword mutation resolver.
tests/libraries/errors/inputValidationError.spec.ts, tests/libraries/errors/invalidFileTypeError.spec.ts Added new test files for input validation and invalid file type errors.
tests/resolvers/Mutation/forgotPassword.spec.ts Introduced a new test case for handling invalid OTP in the forgotPassword mutation.

Assessment against linked issues

Objective Addressed Explanation
Add sample data for Agenda Category ( #2510 )
Remove RemoveFund mutation ( #2510 )
Remove RemoveFundraisingCampaign mutation ( #2510 )

Poem

In the meadow, I hop with glee,
New categories bloom, oh joy for me!
Funds and campaigns, now tucked away,
A simpler path for a brighter day.
With data fresh, we dance and play,
In our cozy burrow, we’ll hop and sway! 🐰✨


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

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

github-actions bot commented Sep 7, 2024

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

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0e711c6 and fd1f6c3.

Files selected for processing (7)
  • sample_data/agendaCategories.json (1 hunks)
  • schema.graphql (1 hunks)
  • src/resolvers/Mutation/index.ts (3 hunks)
  • src/typeDefs/mutations.ts (1 hunks)
  • src/types/generatedGraphQLTypes.ts (3 hunks)
  • src/utilities/loadSampleData.ts (5 hunks)
  • tests/resolvers/Mutation/removeFundCampaignPledge.spec.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • sample_data/agendaCategories.json
  • tests/resolvers/Mutation/removeFundCampaignPledge.spec.ts
Additional comments not posted (11)
src/utilities/loadSampleData.ts (4)

7-7: Approved: Import of AgendaCategoryModel.

The addition of AgendaCategoryModel to the imports list is correctly implemented and necessary for the new functionality.


67-67: Approved: Addition to formatDatabase.

The inclusion of AgendaCategoryModel.deleteMany({}) in the formatDatabase function is appropriate for clearing the agenda categories during database formatting.

Please ensure that this operation does not interfere with any existing data integrity constraints or triggers that might be set on the agendaCategories collection.


171-171: Approved: Inclusion in checkCountAfterImport.

The addition of agendaCategories to the document count checks in the checkCountAfterImport function is appropriate and ensures that the new data model is accounted for in data integrity checks.

Please verify that the document counts are accurate and reflect the expected numbers post-import, especially in scenarios with large data sets.


207-207: Approved: Addition to collections array.

The inclusion of agendaCategories in the collections array is correctly implemented, ensuring that this new collection is considered in data operations.

schema.graphql (3)

Line range hint 1-1: Review of Mutation Removals

The removal of removeFund and removeFundraisingCampaign mutations aligns with the PR objectives to shift from deletion to disabling functionalities for funds and campaigns. This change is consistent with the decision to enhance data integrity and prevent accidental deletions.


Line range hint 1-1: Confirm Removal of removeFundraisingCampaign Mutation

The mutation removeFundraisingCampaign has been successfully removed from the schema. This change should be verified across the system to ensure that no residual code or functionality depends on this mutation.

Run the following script to verify the removal of removeFundraisingCampaign mutation:

Verification successful

Mutation removeFundraisingCampaign Successfully Removed

The removeFundraisingCampaign mutation has been confirmed as removed from the codebase, with no residual references found. The search results only showed references to removeFundraisingCampaignPledge, which is unrelated.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `removeFundraisingCampaign` mutation is completely removed from the schema.

# Test: Search for the mutation usage. Expect: No occurrences.
rg --type graphql -A 5 $'removeFundraisingCampaign'

Length of output: 82


Script:

#!/bin/bash
# Description: Verify that `removeFundraisingCampaign` mutation is completely removed from the codebase.

# Test: Search for the mutation usage across all files. Expect: No occurrences.
rg -A 5 'removeFundraisingCampaign'

Length of output: 6946


Line range hint 1-1: Confirm Removal of removeFund Mutation

The mutation removeFund has been successfully removed from the schema. This change should be verified across the system to ensure that no residual code or functionality depends on this mutation.

Run the following script to verify the removal of removeFund mutation:

Verification successful

removeFund Mutation Successfully Removed

The removeFund mutation has been successfully removed from the codebase. However, there are multiple references to removeFundraisingCampaignPledge, which may indicate a related change or replacement. Ensure that any dependencies on removeFund have been appropriately updated or removed.

  • No occurrences of removeFund found in the codebase.
  • Multiple occurrences of removeFundraisingCampaignPledge found, suggesting a possible replacement.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `removeFund` mutation is completely removed from the schema.

# Test: Search for the mutation usage. Expect: No occurrences.
rg --type graphql -A 5 $'removeFund'

Length of output: 67


Script:

#!/bin/bash
# Description: Verify that `removeFund` mutation is completely removed from the codebase.

# Test: Search for the mutation usage across all files. Expect: No occurrences.
rg 'removeFund'

Length of output: 1552

src/types/generatedGraphQLTypes.ts (2)

Line range hint 1-1000: Confirmed Removal of Mutations:

The mutations removeFund and removeFundraisingCampaign along with their argument types MutationRemoveFundArgs and MutationRemoveFundraisingCampaignArgs have been successfully removed from the file. This aligns with the PR objectives to disallow deletion operations for funds and campaigns.

Please ensure that there are no residual references to these mutations or types elsewhere in the codebase that could lead to errors.


Line range hint 1-1000: Review of File Structure and Consistency:

The file maintains a consistent structure and naming convention across the type definitions. TypeScript features are appropriately used, and the GraphQL schema definitions are in line with best practices.

Ensure to maintain this consistency as new features or changes are introduced to the project.

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

Line range hint 1-1: Removal of mutations approved.

The removal of removeFund and removeFundraisingCampaign aligns with the PR's objectives. Ensure that there are no residual references to these mutations elsewhere in the codebase.

Run the following script to verify that there are no residual references:

Verification successful

Removal of mutations verified successfully.

The removal of removeFund and removeFundraisingCampaign has been verified, and no residual references to these mutations were found in the codebase. The occurrences found were related to a different mutation, removeFundraisingCampaignPledge.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that there are no residual references to removed mutations.

# Test: Search for the removed mutations. Expect: No occurrences.
rg --type ts -A 5 $'removeFund|removeFundraisingCampaign'

Length of output: 6493

src/typeDefs/mutations.ts (1)

Line range hint 1-1: Removal of mutation type definitions approved.

The removal of removeFund and removeFundraisingCampaign type definitions aligns with the PR's objectives. Ensure that there are no residual type definitions or references to these mutations elsewhere in the codebase.

Run the following script to verify that there are no residual type definitions or references:

src/utilities/loadSampleData.ts Show resolved Hide resolved
Copy link

codecov bot commented Sep 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.89%. Comparing base (0e711c6) to head (0399a90).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2511      +/-   ##
===========================================
- Coverage    98.89%   98.89%   -0.01%     
===========================================
  Files          351      349       -2     
  Lines        17990    17766     -224     
  Branches      2403     2371      -32     
===========================================
- Hits         17792    17570     -222     
+ Misses         195      193       -2     
  Partials         3        3              

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

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 7, 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: 2

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fd1f6c3 and 0399a90.

Files selected for processing (4)
  • src/resolvers/Mutation/forgotPassword.ts (1 hunks)
  • tests/libraries/errors/inputValidationError.spec.ts (1 hunks)
  • tests/libraries/errors/invalidFileTypeError.spec.ts (1 hunks)
  • tests/resolvers/Mutation/forgotPassword.spec.ts (1 hunks)
Additional comments not posted (2)
tests/libraries/errors/invalidFileTypeError.spec.ts (1)

6-26: Test implementation for InvalidFileTypeError is correct.

The test is well-structured and correctly asserts the properties of the InvalidFileTypeError. It follows best practices for exception testing in JavaScript.

tests/libraries/errors/inputValidationError.spec.ts (1)

6-26: Test implementation for InputValidationError is correct.

The test is well-structured and correctly asserts the properties of the InputValidationError. It follows best practices for exception testing in JavaScript.

src/resolvers/Mutation/forgotPassword.ts Show resolved Hide resolved
@GlenDsza
Copy link
Contributor Author

GlenDsza commented Sep 7, 2024

@tasneemkoushar @SiddheshKukade PTAL

@tasneemkoushar tasneemkoushar merged commit b4099b9 into PalisadoesFoundation:develop Sep 8, 2024
10 of 11 checks passed
@GlenDsza GlenDsza deleted the fcp_suggestion branch September 8, 2024 12:53
AnshulKahar2729 pushed a commit to AnshulKahar2729/talawa-api that referenced this pull request Sep 18, 2024
…utations (PalisadoesFoundation#2511)

* Add default agendaCategories

* remove removeFund mutation

* removed removeFundraisingCampaign Mutation

* Add test coverage for errorTypes
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