63 lines
2.1 KiB
Python
63 lines
2.1 KiB
Python
from fastapi import APIRouter, HTTPException
|
|
from models.schemas import ImmichAssetsResponse, ImmichAsset
|
|
from services.config import SERVICES
|
|
from datetime import datetime
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/immich/assets",
|
|
response_model=ImmichAssetsResponse,
|
|
summary="Get Immich Assets",
|
|
description="Retrieve photo assets from Immich",
|
|
responses={
|
|
200: {"description": "Successfully retrieved assets"},
|
|
503: {"description": "Immich integration not configured"}
|
|
},
|
|
tags=["Immich"])
|
|
async def get_immich_assets():
|
|
"""Get Immich photo assets including metadata, tags, and face detection results"""
|
|
if not SERVICES["immich"]["enabled"]:
|
|
raise HTTPException(
|
|
status_code=503,
|
|
detail="Immich integration not configured. Please set IMMICH_API_KEY environment variable."
|
|
)
|
|
|
|
# This would make actual API calls to Immich
|
|
# For now, return mock data
|
|
return ImmichAssetsResponse(
|
|
assets=[
|
|
ImmichAsset(
|
|
id="asset_123",
|
|
filename="photo_001.jpg",
|
|
created_at=datetime.now().isoformat(),
|
|
tags=["person", "outdoor"],
|
|
faces=["Alice", "Bob"]
|
|
)
|
|
]
|
|
)
|
|
|
|
@router.get("/immich/albums",
|
|
summary="Get Immich Albums",
|
|
description="Get list of Immich albums",
|
|
responses={
|
|
200: {"description": "Successfully retrieved albums"},
|
|
503: {"description": "Immich integration not configured"}
|
|
},
|
|
tags=["Immich"])
|
|
async def get_immich_albums():
|
|
"""Get list of Immich albums"""
|
|
if not SERVICES["immich"]["enabled"]:
|
|
raise HTTPException(
|
|
status_code=503,
|
|
detail="Immich integration not configured. Please set IMMICH_API_KEY environment variable."
|
|
)
|
|
|
|
# This would make actual API calls to Immich
|
|
# For now, return mock data
|
|
return {
|
|
"albums": [
|
|
{"id": "album_1", "name": "Family Photos", "asset_count": 150},
|
|
{"id": "album_2", "name": "Vacation 2024", "asset_count": 75}
|
|
]
|
|
}
|