working version
This commit is contained in:
24
backend/api/routers/settings.py
Normal file → Executable file
24
backend/api/routers/settings.py
Normal file → Executable file
@@ -40,7 +40,7 @@ async def get_upload_limits(
|
||||
db: Session = Depends(get_db),
|
||||
current_user: User = Depends(get_admin_user)
|
||||
):
|
||||
"""Get current upload limits configuration."""
|
||||
"""Get current upload limits configuration (admin only)."""
|
||||
settings = db.query(SystemSettings).filter(
|
||||
SystemSettings.category == "uploads"
|
||||
).all()
|
||||
@@ -61,6 +61,28 @@ async def get_upload_limits(
|
||||
allowed_video_types=settings_dict.get("allowed_video_types", "video/mp4,video/mpeg,video/quicktime,video/webm").split(",")
|
||||
)
|
||||
|
||||
@router.get("/public/upload-limits", response_model=UploadLimitsResponse)
|
||||
async def get_public_upload_limits(
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
"""Get current upload limits configuration (public endpoint - no auth required)."""
|
||||
settings = db.query(SystemSettings).filter(
|
||||
SystemSettings.category == "uploads"
|
||||
).all()
|
||||
|
||||
# Convertir en dictionnaire pour faciliter l'accès
|
||||
settings_dict = {s.key: s.value for s in settings}
|
||||
|
||||
return UploadLimitsResponse(
|
||||
max_album_size_mb=int(settings_dict.get("max_album_size_mb", "100")),
|
||||
max_vlog_size_mb=int(settings_dict.get("max_vlog_size_mb", "500")),
|
||||
max_image_size_mb=int(settings_dict.get("max_image_size_mb", "10")),
|
||||
max_video_size_mb=int(settings_dict.get("max_video_size_mb", "100")),
|
||||
max_media_per_album=int(settings_dict.get("max_media_per_album", "50")),
|
||||
allowed_image_types=settings_dict.get("allowed_image_types", "image/jpeg,image/png,image/gif,image/webp").split(","),
|
||||
allowed_video_types=settings_dict.get("allowed_video_types", "video/mp4,video/mpeg,video/quicktime,video/webm").split(",")
|
||||
)
|
||||
|
||||
@router.post("/", response_model=SystemSettingResponse)
|
||||
async def create_setting(
|
||||
setting_data: SystemSettingCreate,
|
||||
|
||||
Reference in New Issue
Block a user