Skip to content

Dev#105

Merged
dcloud347 merged 3 commits into
mainfrom
dev
Aug 10, 2025
Merged

Dev#105
dcloud347 merged 3 commits into
mainfrom
dev

Conversation

@dcloud347

Copy link
Copy Markdown
Contributor

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 UserService for credit management.

User Issue Credit Management

  • Added logic in answer_issue to 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)
  • Implemented get_issue_credit and update_issue_credit methods in UserService to retrieve and update a user's issue credits in the database. (prometheus/app/services/user_service.py)
  • Imported UserService in the issue API route to support new credit management logic. (prometheus/app/api/routes/issue.py)

Error Handling Improvements

  • Updated error codes in the get_github_token method: 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]

@dcloud347 dcloud347 merged commit 6720da7 into main Aug 10, 2025
2 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.

1 participant