|
|
@ -2,6 +2,7 @@ from fastapi import APIRouter, HTTPException, status, Depends
|
|
|
|
from bson import ObjectId
|
|
|
|
from bson import ObjectId
|
|
|
|
import pymongo
|
|
|
|
import pymongo
|
|
|
|
from datetime import datetime, timedelta
|
|
|
|
from datetime import datetime, timedelta
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
import app.config as config
|
|
|
|
import app.config as config
|
|
|
|
from app.models import User, HTTPError
|
|
|
|
from app.models import User, HTTPError
|
|
|
@ -133,10 +134,13 @@ async def get_stats(admin_user: User = Depends(get_admin_user)):
|
|
|
|
]))
|
|
|
|
]))
|
|
|
|
|
|
|
|
|
|
|
|
# Statistiques de stockage
|
|
|
|
# Statistiques de stockage
|
|
|
|
total_storage = sum(
|
|
|
|
images_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../images'))
|
|
|
|
image["metadata"]["size"]
|
|
|
|
total_storage = 0
|
|
|
|
for image in images_collection.find({}, {"metadata.size": 1})
|
|
|
|
if os.path.isdir(images_dir):
|
|
|
|
)
|
|
|
|
for filename in os.listdir(images_dir):
|
|
|
|
|
|
|
|
file_path = os.path.join(images_dir, filename)
|
|
|
|
|
|
|
|
if os.path.isfile(file_path):
|
|
|
|
|
|
|
|
total_storage += os.path.getsize(file_path)
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
"general": {
|
|
|
|
"general": {
|
|
|
|