Skip to content

Conversation

@codebestia
Copy link

Summary

This PR Implements a reputation points system for user contributions.

1. IReputationService Interface

  • Created IReputationService with methods for all reputation events
  • Methods for comment upvotes/downvotes, report approvals, vulnerability additions, and ratings

2. ReputationService Implementation

  • Implemented ReputationService with point values:
    • Comment upvote received: +5
    • Comment downvote received: -2
    • Report approved: +25
    • Vulnerability added (by severity):
      • Critical: +50
      • High: +30
      • Medium: +15
      • Low: +5
    • Rating/review posted: +10

3. Reputation History Logging

  • Created ReputationHistoryModel to track all reputation changes
  • Logs include: user ID, points change, new reputation, reason, and timestamp
  • Added migration for the reputation_history table

4. Integration with Existing Services

  • Updated ReportService to award reputation when reports are approved
  • Updated VulnerabilityService to award reputation when vulnerabilities are approved
  • Both services check if items were already approved to avoid duplicate awards

5. Background Job for Recalculation

  • Added reputation recalculation to BackgroundWorkingHostedService
  • Runs once per day to ensure data integrity
  • Recalculates reputation for all users based on their contributions

6. Database Updates

  • Added ReputationHistoryModel to the database context
  • Created migration file for the new table
  • UserProfile already has ReputationScore field (existing)

Notes:

  • Comments and ratings are not yet implemented in the system, but the service has placeholder methods ready for when those features are added
  • The recalculation method includes comments and ratings in its comments for future implementation

Related Issue

Closes #92

@codebestia
Copy link
Author

GM @SurfingBowser
Please review

@codebestia
Copy link
Author

@0xGeorgii Please review

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.

Implement Reputation Points Calculation Service

1 participant