Edit get avatar

This commit is contained in:
2026-01-26 13:25:18 +03:00
parent 1dce2c7b0c
commit dd05e7f5c7
4 changed files with 17 additions and 2 deletions
+14
View File
@@ -15,6 +15,7 @@ from app.chats.router import router as chat_router
from app.core.log_config import set_logging
from app.core.config import settings
from app.services.messenger_service import PubSubMessenger
from app.utils.S3_client import s3_client
set_logging()
log = logging.getLogger(__name__)
@@ -42,6 +43,19 @@ api_router.include_router(chat_router)
async def test_health():
return {"status": True}
@api_router.get("/files/{filename}")
async def get_file(filename: str):
file_data = await s3_client.download_file(filename)
content_type = "image/jpeg"
if filename.endswith(".png"):
content_type = "image/png"
# Возвращаем файл напрямую из памяти
return Response(
content=file_data,
media_type=content_type
)
app = FastAPI(
title=settings.COMPANY_NAME,
description="## Backend messenger aether",