feat: Implement image thumbnail generation, storage, and API endpoints for assets, including a regeneration utility.

This commit is contained in:
xds
2026-02-05 20:52:50 +03:00
parent 736e5a8c12
commit 76dd976854
26 changed files with 127 additions and 20 deletions

View File

@@ -5,7 +5,7 @@ from pydantic import BaseModel
from starlette.exceptions import HTTPException
from starlette.requests import Request
from api.models.AssetDTO import AssetsResponse
from api.models.AssetDTO import AssetsResponse, AssetResponse
from api.models.GenerationRequest import GenerationRequest, GenerationResponse
from models.Asset import Asset
from models.Character import Character
@@ -35,7 +35,9 @@ async def get_character_assets(character_id: str, dao: DAO = Depends(get_dao), l
raise HTTPException(status_code=404, detail="Character not found")
assets = await dao.assets.get_assets_by_char_id(character_id, limit, offset)
total_count = await dao.assets.get_asset_count(character_id)
return AssetsResponse(assets=assets, total_count=total_count)
asset_responses = [AssetResponse.model_validate(a.model_dump()) for a in assets]
return AssetsResponse(assets=asset_responses, total_count=total_count)
@router.get("/{character_id}", response_model=Character)