diff --git a/db.py b/db.py index 886cbc7..9131dc5 100644 --- a/db.py +++ b/db.py @@ -185,7 +185,7 @@ async def get_asset(name: str) -> Optional[dict]: """Get asset by name.""" async with get_connection() as conn: row = await conn.fetchrow( - """SELECT name, content_hash, asset_type, tags, metadata, url, + """SELECT name, content_hash, ipfs_cid, asset_type, tags, metadata, url, provenance, description, origin, owner, created_at, updated_at FROM assets WHERE name = $1""", name @@ -199,7 +199,7 @@ async def get_asset_by_hash(content_hash: str) -> Optional[dict]: """Get asset by content hash.""" async with get_connection() as conn: row = await conn.fetchrow( - """SELECT name, content_hash, asset_type, tags, metadata, url, + """SELECT name, content_hash, ipfs_cid, asset_type, tags, metadata, url, provenance, description, origin, owner, created_at, updated_at FROM assets WHERE content_hash = $1""", content_hash @@ -213,7 +213,7 @@ async def get_all_assets() -> dict[str, dict]: """Get all assets as a dict indexed by name.""" async with get_connection() as conn: rows = await conn.fetch( - """SELECT name, content_hash, asset_type, tags, metadata, url, + """SELECT name, content_hash, ipfs_cid, asset_type, tags, metadata, url, provenance, description, origin, owner, created_at, updated_at FROM assets ORDER BY created_at DESC""" ) @@ -225,7 +225,7 @@ async def get_assets_paginated(limit: int = 100, offset: int = 0) -> tuple[list[ async with get_connection() as conn: total = await conn.fetchval("SELECT COUNT(*) FROM assets") rows = await conn.fetch( - """SELECT name, content_hash, asset_type, tags, metadata, url, + """SELECT name, content_hash, ipfs_cid, asset_type, tags, metadata, url, provenance, description, origin, owner, created_at, updated_at FROM assets ORDER BY created_at DESC LIMIT $1 OFFSET $2""", limit, offset @@ -237,7 +237,7 @@ async def get_assets_by_owner(owner: str) -> dict[str, dict]: """Get all assets owned by a user.""" async with get_connection() as conn: rows = await conn.fetch( - """SELECT name, content_hash, asset_type, tags, metadata, url, + """SELECT name, content_hash, ipfs_cid, asset_type, tags, metadata, url, provenance, description, origin, owner, created_at, updated_at FROM assets WHERE owner = $1 ORDER BY created_at DESC""", owner