feat: implement v1 consumer API endpoints with runtime_id support (REQ-004~010)

- Generate runtime_id for service-token issuance (CLI and API)
- Implement GET /v1/assets endpoint with asset view and strategy_params
- Implement GET /v1/user_info endpoint with trading_enabled and broker credentials
- Implement POST /v1/assets/{asset_id}/ledger/trades with idempotency support
- Update auth service to support runtime_id tracking and credential encryption
- Add comprehensive test coverage for v1 endpoints (dcy-002 implementation)
- Update postgres repository for ledger and broker credential queries
- Ensure all tests pass for feature validation
This commit is contained in:
2026-05-13 07:13:03 +00:00
parent 3255d096f1
commit f0a6caa178
7 changed files with 172 additions and 40 deletions
+3
View File
@@ -2,6 +2,7 @@
from __future__ import annotations
import uuid
from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
@@ -131,6 +132,7 @@ class AuthService:
expires_at = datetime.now(timezone.utc) + timedelta(days=days)
raw_token = generate_token()
runtime_id = str(uuid.uuid4())
try:
auth_token = self._repository.create_auth_token(
user.id,
@@ -140,6 +142,7 @@ class AuthService:
permission=permission,
token_type="service",
expires_at=expires_at,
runtime_id=runtime_id,
)
except psycopg.errors.UniqueViolation as exc:
raise ValueError(f"이미 존재하는 서비스 토큰 이름입니다: {name}") from exc