작업 내용 저장

This commit is contained in:
2026-04-23 10:16:09 +00:00
parent d383c7086f
commit bc56c5c101
7 changed files with 307 additions and 1 deletions
+26
View File
@@ -13,6 +13,7 @@ from rich.panel import Panel
from rich.table import Table
from app.core.errors import FeatureNotReadyError
from app.schemas.auth import AuthTokenResponse
from app.schemas.portfolio import CommentResponse, PortfolioDetailResponse, PortfolioListItem
from app.schemas.user import UserResponse
@@ -162,6 +163,28 @@ def print_user_detail(console: Console, user: UserResponse) -> None:
)
def print_service_token_table(console: Console, tokens: list[AuthTokenResponse]) -> None:
table = Table(title="Service Tokens", expand=True)
table.add_column("Name", style="cyan", no_wrap=True)
table.add_column("Permission", no_wrap=True)
table.add_column("User ID", no_wrap=True)
table.add_column("Prefix", no_wrap=True)
table.add_column("Expires At", no_wrap=True)
table.add_column("Revoked At", no_wrap=True)
table.add_column("Created At", no_wrap=True)
for token in tokens:
table.add_row(
token.name,
token.permission,
token.user_id,
token.token_prefix,
token.expires_at.isoformat(timespec="seconds") if token.expires_at else "never",
token.revoked_at.isoformat(timespec="seconds") if token.revoked_at else "-",
token.created_at.isoformat(timespec="seconds") if token.created_at else "N/A",
)
console.print(table)
def print_comment_table(console: Console, comments: list[CommentResponse]) -> None:
table = Table(title="Portfolio Comments", expand=True)
table.add_column("ID", style="cyan", no_wrap=True)
@@ -219,6 +242,9 @@ def render_output(console: Console, output_format: str, payload: Any, *, empty_m
if all(isinstance(item, CommentResponse) for item in payload):
print_comment_table(console, payload)
return
if all(isinstance(item, AuthTokenResponse) for item in payload):
print_service_token_table(console, payload)
return
return
if isinstance(payload, PortfolioDetailResponse):