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

refactor(api): add user Depends for list api #766

Merged
merged 3 commits into from
Mar 4, 2025
Merged

refactor(api): add user Depends for list api #766

merged 3 commits into from
Mar 4, 2025

Conversation

ch-liuzhide
Copy link
Contributor

No description provided.

Copy link

vercel bot commented Mar 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
petercat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 4, 2025 11:05am

Copy link

Walkthrough

This pull request refactors several API endpoints by adding a user dependency to ensure that the user is authenticated before proceeding with the request. If the user is not authenticated, an HTTP 401 Unauthorized error is raised.

Changes

File Summary
server/rag/router.py Refactored API endpoints /knowledge/list, /task/list, and /task/restart to include a user dependency check. If the user is not authenticated, an HTTP 401 Unauthorized error is raised.

params: PageParams[Task],
user: Annotated[User | None, Depends(get_user)] = None,
):
if user is None:

Choose a reason for hiding this comment

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

The addition of a user dependency and the subsequent check for user authentication is a critical change. It ensures that only authenticated users can access these endpoints, which is important for maintaining security and data integrity.

Copy link

codecov bot commented Mar 4, 2025

Codecov Report

Attention: Patch coverage is 33.33333% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
server/rag/router.py 33.33% 6 Missing ⚠️
Files with missing lines Coverage Δ
server/rag/router.py 39.68% <33.33%> (-4.18%) ⬇️

... and 1 file with indirect coverage changes

@ch-liuzhide ch-liuzhide merged commit 724e887 into main Mar 4, 2025
4 of 5 checks passed
@ch-liuzhide ch-liuzhide deleted the whisker branch March 4, 2025 11:14
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