Files
endurain/backend/app/core/utils.py
João Vitória Silva be6c4b1bd4 Fix activity media path and update dependencies
Corrected the file path construction in return_activity_media_path to remove hardcoded base path. Updated frontend and backend dependencies, including grpcio and numpy versions.
2025-07-25 11:05:20 +01:00

30 lines
793 B
Python

from fastapi.responses import FileResponse
import os
import core.config as core_config
def return_frontend_index(path: str):
return FileResponse(core_config.FRONTEND_DIR + "/" + path)
def return_user_img_path(user_img: str):
file_path = f"{core_config.USER_IMAGES_DIR}/" + user_img
if not os.path.isfile(file_path):
return None
return FileResponse(file_path)
def return_server_img_path(server_img: str):
file_path = f"{core_config.SERVER_IMAGES_DIR}/" + server_img
if not os.path.isfile(file_path):
return None
return FileResponse(file_path)
def return_activity_media_path(media: str):
file_path = f"{core_config.ACTIVITY_MEDIA_DIR}/" + media
if not os.path.isfile(file_path):
return None
return FileResponse(file_path)