Files
shaguabijia-app-server/app/schemas/order_record.py
T
chenshuobo c1ce109f13 feat: 新增 GET /api/v1/user/records 订单记录分页接口
- 新增 OrderRecord 模型 (user_id, platform, store_name, dishes, order_date, price, original_price, savings)
- 新增 order_record schema (OrderRecordOut + OrderListResponse)
- 新增 CRUD: get_records_page 按 order_date DESC 分页查询
- 新增 /api/v1/user/records 路由, 需 Bearer token 鉴权, 支持 page/size 参数
- Alembic 迁移: add order_record table
- platform 支持: meituan_waimai / taobao_shanguang / jd_waimai / meituan / taobao / jd
- dishes 字段 DB 存 JSON 字符串, 接口返回 list[str]

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 21:11:05 +08:00

23 lines
460 B
Python

from __future__ import annotations
from pydantic import BaseModel, ConfigDict
class OrderRecordOut(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
platform: str
store_name: str
dishes: list[str]
order_date: str
price: str
original_price: str | None = None
savings: str | None = None
class OrderListResponse(BaseModel):
records: list[OrderRecordOut]
has_next: bool = False
page: int = 1