Merge branch 'main' of https://git.1024tool.vip/zfc/guzhi
* 'main' of https://git.1024tool.vip/zfc/guzhi: feat(发票模型): 添加app_user_id字段并启用属性转换
This commit is contained in:
commit
28a5607dad
@ -14,6 +14,7 @@ class InvoiceHeaderCreate(BaseModel):
|
||||
|
||||
class InvoiceHeaderOut(BaseModel):
|
||||
id: int
|
||||
app_user_id: Optional[int] = None
|
||||
company_name: str
|
||||
tax_number: str
|
||||
register_address: str
|
||||
@ -21,6 +22,8 @@ class InvoiceHeaderOut(BaseModel):
|
||||
bank_name: str
|
||||
bank_account: str
|
||||
email: EmailStr
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class InvoiceHeaderUpdate(BaseModel):
|
||||
|
||||
@ -104,7 +104,7 @@ class ValuationAssessmentUpdate(BaseModel):
|
||||
inheritor_certificates: Optional[List[Any]] = Field(None, description="非遗传承人等级证书")
|
||||
heritage_level: Optional[str] = Field(None, description="非遗等级")
|
||||
patent_application_no: Optional[str] = Field(None, description="非遗资产所用专利的申请号")
|
||||
historical_evidence: Optional[List[Any]] = Field(None, description="非遗资产历史证明证据及数量")
|
||||
historical_evidence: Optional[Dict[str, int]] = Field(None, description="非遗资产历史证明证据及数量")
|
||||
patent_certificates: Optional[List[Any]] = Field(None, description="非遗资产所用专利的证书")
|
||||
pattern_images: Optional[List[Any]] = Field(None, description="非遗纹样图片")
|
||||
report_url: Optional[str] = Field(None, description="评估报告URL")
|
||||
@ -129,6 +129,20 @@ class ValuationAssessmentUpdate(BaseModel):
|
||||
|
||||
is_active: Optional[bool] = Field(None, description="是否激活")
|
||||
|
||||
@field_validator('report_url', 'certificate_url', mode='before')
|
||||
@classmethod
|
||||
def _coerce_url(cls, v):
|
||||
if v is None:
|
||||
return None
|
||||
if isinstance(v, list) and v:
|
||||
v = v[0]
|
||||
if isinstance(v, str):
|
||||
s = v.strip()
|
||||
if s.startswith('`') and s.endswith('`'):
|
||||
s = s[1:-1].strip()
|
||||
return s
|
||||
return v
|
||||
|
||||
|
||||
class ValuationAssessmentOut(ValuationAssessmentBase):
|
||||
"""估值评估输出模型"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user