Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces user issue credit management and improves error handling in the issue and repository API routes. The main change is the addition of logic to check and deduct user issue credits when answering issues, ensuring users have sufficient credits to perform actions. It also refines error codes for better consistency and adds new methods to the
UserServicefor credit management.User Issue Credit Management
answer_issueto check if the authenticated user has sufficient issue credits before proceeding, and deducts one credit per issue answered. If credits are insufficient, a clear error is returned. (prometheus/app/api/routes/issue.py)get_issue_creditandupdate_issue_creditmethods inUserServiceto retrieve and update a user's issue credits in the database. (prometheus/app/services/user_service.py)UserServicein the issue API route to support new credit management logic. (prometheus/app/api/routes/issue.py)Error Handling Improvements
get_github_tokenmethod: changed the code for missing GitHub token from 401/423 to 400 for more consistent client error handling. (prometheus/app/api/routes/repository.py) [1] [2]