feat: Add pagination with total count to generation listings and enable filtering assets by type.

This commit is contained in:
xds
2026-02-08 02:13:59 +03:00
parent aa50b1cc03
commit 31893414eb
14 changed files with 30 additions and 9 deletions

View File

@@ -39,5 +39,13 @@ class GenerationRepo:
generations.append(Generation(**generation))
return generations
async def count_generations(self, character_id: Optional[str] = None, status: Optional[GenerationStatus] = None) -> int:
args = {}
if character_id is not None:
args["linked_character_id"] = character_id
if status is not None:
args["status"] = status
return await self.collection.count_documents(args)
async def update_generation(self, generation: Generation, ):
res = await self.collection.update_one({"_id": ObjectId(generation.id)}, {"$set": generation.model_dump()})