feat(req-002): implement portfolio tagging and tag filters
This commit is contained in:
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
from datetime import datetime
|
||||
from typing import Any, Literal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
||||
|
||||
|
||||
class StrategySetResponse(BaseModel):
|
||||
@@ -45,6 +45,7 @@ class PortfolioSummary(BaseModel):
|
||||
status: str
|
||||
name: str
|
||||
symbol: str
|
||||
tags: list[str] = Field(default_factory=list)
|
||||
owner_user_id: str | None = None
|
||||
cash_balance: float = 0.0
|
||||
asset_quantity: float = 0.0
|
||||
@@ -140,6 +141,24 @@ class CommentResponse(BaseModel):
|
||||
updated_at: datetime | None = None
|
||||
|
||||
|
||||
class PortfolioTagMutationRequest(BaseModel):
|
||||
tag: str = Field(min_length=1)
|
||||
|
||||
@field_validator("tag")
|
||||
@classmethod
|
||||
def normalize_tag(cls, value: str) -> str:
|
||||
normalized = value.strip()
|
||||
if not normalized:
|
||||
raise ValueError("tag는 비어 있을 수 없습니다")
|
||||
return normalized
|
||||
|
||||
|
||||
class PortfolioTagResponse(BaseModel):
|
||||
portfolio_id: str
|
||||
tag: str
|
||||
created_at: datetime | None = None
|
||||
|
||||
|
||||
class ErrorResponse(BaseModel):
|
||||
detail: str
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
Reference in New Issue
Block a user