Merge pull request #12431 from gaby/fix-12237

feat: Allow making content optional when listing all files
This commit is contained in:
Timothy Jaeryang Baek 2025-04-06 15:13:13 -07:00 committed by GitHub
commit 1e98ae7608
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -162,11 +162,17 @@ def upload_file(
@router.get("/", response_model=list[FileModelResponse])
async def list_files(user=Depends(get_verified_user)):
async def list_files(
user=Depends(get_verified_user), include_content: bool = Query(True)
):
if user.role == "admin":
files = Files.get_files()
else:
files = Files.get_files_by_user_id(user.id)
if not include_content:
for file in files:
file.data["content"] = ""
return files