feat: show source directories in library stats and settings UI
Add active source root directories to the library stats endpoint and display them in the settings page. Hardcode container PHOTO_DIRS to /photos since the volume mount handles host path mapping. Add .env to .gitignore to prevent committing secrets. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.database import get_db
|
||||
from app.models import Photo
|
||||
from app.models.folders import SourceRoot
|
||||
from app.models.user import User
|
||||
from app.dependencies import get_current_user
|
||||
|
||||
@@ -105,6 +106,13 @@ async def get_library_stats(
|
||||
|
||||
size = (await db.execute(select(func.sum(Photo.file_size)).where(owner))).scalar() or 0
|
||||
|
||||
# Source root directories (active ones only).
|
||||
roots = (
|
||||
await db.execute(
|
||||
select(SourceRoot.path).where(SourceRoot.is_active.is_(True)).order_by(SourceRoot.path)
|
||||
)
|
||||
).scalars().all()
|
||||
|
||||
return {
|
||||
"all_photos": all_photos_count,
|
||||
"rated": rated_count,
|
||||
@@ -116,6 +124,7 @@ async def get_library_stats(
|
||||
"total_videos": video_count,
|
||||
"total_size": size,
|
||||
"total_size_gb": round(size / (1024**3), 2) if size else 0,
|
||||
"source_dirs": roots,
|
||||
}
|
||||
|
||||
@router.post("/scan")
|
||||
|
||||
Reference in New Issue
Block a user