feat: REQ-002/REQ-010 implementation — assets.tag_ids column + GET /v1/assets admin catalog (BAT-012)

- REQ-002 scope redefinition: portfolios.tag_ids → assets.tag_ids UUID[] column with GIN index
- REQ-010 augmentation: GET /v1/assets redesigned as admin catalog endpoint (admin-only, no token_type branching)
- Asset tagging infrastructure: tag_ids column, archived flag synthesis for inactive tags, list_assets N+1 optimization
- DB migration 20260521_0023: assets.tag_ids UUID[] NOT NULL DEFAULT '{}', idx_assets_tag_ids_gin
- Test suite: 17 new test cases for assets.tag_ids + GET /v1/assets AC-9~12 (362 tests total)
- Documentation: runtime flows, release baseline, batch verification all updated
- BAT-012 added to REL-001 Included Batch and marked release-candidate

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-21 23:37:08 +09:00
co-authored by Claude Opus 4.7
parent d01039e98f
commit 9038f41010
19 changed files with 867 additions and 47 deletions
+5 -2
View File
@@ -87,7 +87,8 @@ _SELECT_ASSET = """
display_name,
status,
created_at,
updated_at
updated_at,
COALESCE(tag_ids, '{}'::uuid[])
FROM assets
"""
@@ -463,6 +464,7 @@ class PostgresPortfolioRepository:
status=row[4] or "active",
created_at=row[5],
updated_at=row[6],
tag_ids=[str(t) for t in row[7]] if len(row) > 7 and row[7] is not None else [],
)
@staticmethod
@@ -1503,7 +1505,8 @@ class PostgresPortfolioRepository:
"""
INSERT INTO assets (symbol, markets, display_name, status)
VALUES (%s, %s, %s, %s)
RETURNING asset_id, symbol, markets, display_name, status, created_at, updated_at
RETURNING asset_id, symbol, markets, display_name, status, created_at, updated_at,
COALESCE(tag_ids, '{}'::uuid[])
""",
(symbol, markets, display_name, status),
)