刘涛 8c0a5f489d Initial commit: hulai admin API backend
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 22:01:23 +08:00

28 行
688 B
Python

from __future__ import annotations
from pydantic import BaseModel, field_validator
class PricingItemSchema(BaseModel):
product_name: str
product_slug: str | None = None
price_from: str | None = None
price_unit: str | None = None
price_label: str | None = None
description: str | None = None
features: list[str] = []
notes: list[str] = []
is_visible: bool = True
@field_validator('features', 'notes', mode='before')
@classmethod
def coerce_none_to_list(cls, v):
return v if v is not None else []
class PricingItemResponse(PricingItemSchema):
id: int
sort_order: int = 0
class Config:
from_attributes = True