Skip to content

Commit

Permalink
create CollOut after
Browse files Browse the repository at this point in the history
  • Loading branch information
ikreymer committed Feb 8, 2025
1 parent e505a70 commit c913532
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 4 additions & 5 deletions backend/btrixcloud/colls.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,24 +341,23 @@ async def get_collection_out(
) -> CollOut:
"""Get CollOut by id"""
result = await self.get_collection_raw(coll_id, public_or_unlisted_only)
coll = CollOut.from_dict(result)

if resources:
coll.resources = await self.get_collection_crawl_resources(coll_id)
result["resources"] = await self.get_collection_crawl_resources(coll_id)

pages, _ = await self.page_ops.list_collection_pages(
coll_id, is_seed=True, page_size=25
)
coll.pages = cast(List[PageOut], pages)
result["pages"] = pages

thumbnail = result.get("thumbnail")
if thumbnail:
image_file = ImageFile(**thumbnail)
coll.thumbnail = await image_file.get_image_file_out(
result["thumbnail"] = await image_file.get_image_file_out(
org, self.storage_ops
)

return coll
return CollOut.from_dict(result)

async def get_public_collection_out(
self,
Expand Down
4 changes: 4 additions & 0 deletions backend/btrixcloud/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,7 @@ def get_image_file(

### PAGES ###


# ============================================================================
class PageReviewUpdate(BaseModel):
"""Update model for page manual review/approval"""
Expand Down Expand Up @@ -1374,10 +1375,13 @@ class PageUrlCount(BaseModel):
url: AnyHttpUrl
count: int = 0
snapshots: List[PageIdTimestamp] = []


# ============================================================================

### COLLECTIONS ###


# ============================================================================
class CollAccessType(str, Enum):
"""Collection access types"""
Expand Down

0 comments on commit c913532

Please sign in to comment.