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

delete previous_round_rank when deleting a project #1809

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

mohammadranjbarz
Copy link
Collaborator

@mohammadranjbarz mohammadranjbarz commented Sep 10, 2024

related to Giveth/giveth-dapps-v2#1271

Summary by CodeRabbit

  • New Features

    • Enhanced project deletion functionality now removes related entries in the PreviousRoundRank table, ensuring data integrity.
    • Updated wallet-related method in the ProjectResolver to accept additional parameters for improved functionality and clarity.
  • Bug Fixes

    • Minor formatting adjustments made in test cases for improved readability.

@mohammadranjbarz mohammadranjbarz marked this pull request as ready for review September 11, 2024 05:37
Copy link
Contributor

coderabbitai bot commented Sep 11, 2024

Walkthrough

The changes encompass updates to three files, including enhancements to a test case, the addition of a deletion operation for PreviousRoundRank in the project repository, and modifications to method documentation in the project resolver. The updates aim to improve functionality and clarity across the codebase without altering any public entity declarations.

Changes

Files Change Summary
src/repositories/projectRepository.test.ts Minor formatting change in removeProjectAndRelatedEntitiesTestCase function.
src/repositories/projectRepository.ts Added import for PreviousRoundRank; modified removeProjectAndRelatedEntities to delete related entries.
src/resolvers/projectResolver.ts Enhanced documentation for method parameters, adding chainType and memo.

Poem

🐇 In the code where rabbits play,
Changes hop in bright array.
A project gone, its friends set free,
Deleting ranks, oh what glee!
With clearer paths and docs that shine,
Our code now dances, oh so fine! 🌟


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 751308d and b4fb94d.

Files selected for processing (3)
  • src/repositories/projectRepository.test.ts (1 hunks)
  • src/repositories/projectRepository.ts (2 hunks)
  • src/resolvers/projectResolver.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/repositories/projectRepository.test.ts
Additional comments not posted (2)
src/repositories/projectRepository.ts (1)

25-25: LGTM!

The changes to import PreviousRoundRank and delete its associated entries when removing a project are implemented correctly. This ensures data consistency and prevents orphaned records.

Also applies to: 604-607

src/resolvers/projectResolver.ts (1)

1791-1792: Verify the method signature and implementation.

The method documentation has been updated to include @param chainType chain ChainType and @param memo wallet address, suggesting that the method should now handle these parameters. However, the corresponding method signature and implementation are not provided in the diff.

Please verify that:

  1. The method signature has been updated to include the chainType and memo parameters.
  2. The method implementation has been updated to use the chainType and memo parameters correctly.

To verify the method signature and implementation, run the following script:

Verification successful

Method signature and implementation verified.

The walletAddressIsValid method in src/resolvers/projectResolver.ts has been updated to include the chainType and memo parameters in its signature. These parameters are also used in the method implementation, confirming that the documentation update is consistent with the code.

  • src/resolvers/projectResolver.ts: Method walletAddressIsValid includes chainType and memo parameters.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the method signature includes `chainType` and `memo` parameters and the implementation uses them correctly.

# Test: Search for the method declaration. Expect: The method signature includes `chainType` and `memo` parameters.
ast-grep --lang typescript --pattern $'Query(_returns => Boolean)
  async walletAddressIsValid(
    @Arg(\'address\') address: string,
    @Arg(\'chainType\', { nullable: true }) chainType?: ChainType,
    @Arg(\'memo\', { nullable: true }) memo?: string,
  )'

# Test: Search for the method implementation. Expect: The `chainType` and `memo` parameters are used in the method body.
rg --type typescript -A 10 $'async walletAddressIsValid\\(.*\\)' | rg -e 'chainType' -e 'memo'

Length of output: 1035


Script:

#!/bin/bash
# Description: Verify the method signature includes `chainType` and `memo` parameters and the implementation uses them correctly.

# Test: Search for the method declaration. Expect: The method signature includes `chainType` and `memo` parameters.
ast-grep --lang typescript --pattern $'async walletAddressIsValid($_, $_, $_, $_)'

# Test: Search for the method implementation. Expect: The `chainType` and `memo` parameters are used in the method body.
rg --type ts -A 10 $'async walletAddressIsValid\\(.*\\)' | rg -e 'chainType' -e 'memo'

Length of output: 165


Script:

#!/bin/bash
# Description: Locate the method `walletAddressIsValid` and verify its parameters and usage.

# Search for any occurrence of `walletAddressIsValid` in the codebase to locate the method.
rg 'walletAddressIsValid' --type ts -A 10

# Once located, check if the method includes `chainType` and `memo` parameters and if they are used in the implementation.
rg 'chainType' --type ts -A 10
rg 'memo' --type ts -A 10

Length of output: 307115


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.

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
Collaborator

@kkatusic kkatusic left a comment

Choose a reason for hiding this comment

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

LGTM ;) thx @mohammadranjbarz

@mohammadranjbarz mohammadranjbarz merged commit bebce89 into staging Sep 11, 2024
5 checks passed
@mohammadranjbarz mohammadranjbarz deleted the 1271_fix_creating_draft_project_error branch September 11, 2024 11:33
CarlosQ96 added a commit that referenced this pull request Oct 3, 2024
* fix: remove memo for project verification managing funds

* fix: remove memo for project verification managing funds

* add projectId and qfRoundId to qf data export

* fix: getDraftDonationById bug (toWalletMemo can be null)

* fix: add memo for stellar project address uniqueness

* fix: add memo for manage address validation

* fix: add duplicate address error message for stellar

* fix: linter error

* add index for project stellar address

* eslint error

* fix: case when owner donate to his own peoject (Stellar chain)

* fix: add calculateGivbackFactor to Stellar cron job

* onlyEndaement option added to donationResolvers to get only endaoment projects

* chore: implementing coderabbitai suggestion to remove string literal

* feat: register secondary donation

* running migration to set project banners appropriately for endaoment … (#1778)

* running migration to set project banners appropriately for endaoment projects

* chore: correcting tab spaces for syntax

* fix: linter errors

* Modify add banner to endaoment projects migration (#1791)

related to #1600

* Fix lint errors

* Fix running tests

* Fix projectResolver test cases

* Fix donationResolver test cases

* skip should renew the expiration date of the draft donation test case

---------

Co-authored-by: Hrithik Sampson <[email protected]>
Co-authored-by: mohammadranjbarz <[email protected]>

* improve adminjs to import qfround matching and better filters

* fix eslint

* fix: remove adding secondary donation logic

* fix minor form issues

* order middleware in bootstrap file

* test: add test cases to fetch only Endaoment projects

* chore: change the second Project to first Project

* chore: change the second Project to first Project

* chore: change the second Project to first Project

* chore: change the second user to new user since it is interfering with the pre-existing test cases

* delete previous_round_rank when deleting a project (#1809)

* Implement  allocatedGivbacks function (#1808)

* WIP Implement  allocatedGivbacks function

related to Giveth/giveth-dapps-v2#4678 Giveth/giveth-dapps-v2#4679

* allocatedGivbacks() endpoint implemented and works

related to Giveth/giveth-dapps-v2#4678 Giveth/giveth-dapps-v2#4679

* Fix allocatedGivbacksQuery test cases

* migration: project banners for endaoment projects need to have the correct banners

* chore: underscore before unused variable in add_endaoment_project_banners

* Use Gnosis giv token for getting price of GIV

* Use superfluid mock adapter for test cases

* Use superfluid adapter on test env again

* Feat/separate givback verfied (#1770)

* add isGivbackEligible field

* add AddIsGivbackEligibleColumnToProject1637168932304

* add UpdateIsGivbackEligibleForVerifiedProjects1637168932305 migration

* add migration to rename isProjectVerified to isProjectGivbackEligible

* change isProjectVerified tp isProjectGivbackEligible

* update octant donation

* add approve project

* treat project.verified and project.isGivbackEligible equally on sorting

* remove reset verification status on verify

* check isGivbackEligible on create ProjectVerificationForm

* add ProjectInstantPowerViewV3 migration

* use verifiedOrIsGivbackEligibleCondition

* Use different materialized view for givback factor

related to #1770

* Fix build error

* Fix build error

* Fix project query for isGivbackEligible and verified

* Fix add base token migration

* Fix eslint errors

* Fix add base token migration

* Fix add base token migration

* Fix add base token migration

* Fix donation test cases related to isGivbackEligible

* Fix build error

---------

Co-authored-by: Mohammad Ranjbar Z <[email protected]>

* Fix test cases related to isProjectVerified

* add isImported And categories to project tab

* fix isProjectGivbackEligible Migration in wrong folder

* add chaintype and solana networks to tokenTab

* update branch

* add environment and energy image mapping

* add categories to show and edit forms in adminjs for projects

* fix eslint

* add best match sort option

* update addSearchQuery to prioritize the title

* Add Stellar to QFRound

* run linter

* remove eager from project categories in entity

* Add isGivbackEligible filter

* Hotfix automatic model score sync (#1849)

* add user mbdscore sync workers and cronjob

* add active env var for syncing score

* add tests to the user sync worker and cronjob

* prevent duplicate tokens being added in adminJS

* Ensure correct emails are sent for project status changes related to decentralized verification

* fix test

* fix test cases

* fix test cases

---------

Co-authored-by: Meriem-BM <[email protected]>
Co-authored-by: Carlos <[email protected]>
Co-authored-by: HrithikSampson <[email protected]>
Co-authored-by: HrithikSampson <[email protected]>
Co-authored-by: Hrithik Sampson <[email protected]>
Co-authored-by: CarlosQ96 <[email protected]>
Co-authored-by: Cherik <[email protected]>
Co-authored-by: Ramin <[email protected]>
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