diff --git a/backend/app/api/v1/endpoints/orders.py b/backend/app/api/v1/endpoints/orders.py index 57d1410..22268df 100644 --- a/backend/app/api/v1/endpoints/orders.py +++ b/backend/app/api/v1/endpoints/orders.py @@ -19,6 +19,7 @@ async def list_orders( skip: int = Query(0, ge=0), limit: int = Query(50, ge=1, le=200), db: AsyncSession = Depends(get_db), + current_user: dict = Depends(get_current_user), ): result = await db.execute( select(ProductionOrder).offset(skip).limit(limit).order_by(ProductionOrder.created_at.desc()) diff --git a/backend/app/api/v1/endpoints/products.py b/backend/app/api/v1/endpoints/products.py index b75e2e4..878faa8 100644 --- a/backend/app/api/v1/endpoints/products.py +++ b/backend/app/api/v1/endpoints/products.py @@ -26,7 +26,10 @@ router = APIRouter(prefix="/products", tags=["产品管理"]) # ============================================================ @router.get("/qrcode/{serial_number}") -async def get_product_qrcode(serial_number: str): +async def get_product_qrcode( + serial_number: str, + current_user: dict = Depends(get_current_user), +): """ 生成产品二维码(PNG 图片)。 内容为 16 位序列号,扫描后可调用 /scan/{serial_number} 查询产品。 @@ -50,6 +53,7 @@ async def get_product_qrcode(serial_number: str): async def scan_product( serial_number: str, db: AsyncSession = Depends(get_db), + current_user: dict = Depends(get_current_user), ): """ 扫码接口:根据 16 位序列号查询产品及其当前进度。 @@ -69,6 +73,7 @@ async def list_products( keyword: str | None = Query(None, description="多维搜索: 产品身份证/订单号/规格型号"), status: str | None = Query(None, description="产品状态筛选: PENDING/WIP/COMPLETED/ARCHIVED"), db: AsyncSession = Depends(get_db), + current_user: dict = Depends(get_current_user), ): """获取产品列表 — 支持 keyword 搜索 + 状态筛选""" return await product_service.get_all_products( @@ -80,6 +85,7 @@ async def list_products( async def get_product( product_id: str, db: AsyncSession = Depends(get_db), + current_user: dict = Depends(get_current_user), ): """获取单个产品详情""" import uuid @@ -196,6 +202,7 @@ class MessageCreate(BaseModel): async def get_product_messages( product_id: str, db: AsyncSession = Depends(get_db), + current_user: dict = Depends(get_current_user), ): """获取某产品的所有留言(按时间正序)""" result = await db.execute( diff --git a/backend/app/api/v1/endpoints/tasks.py b/backend/app/api/v1/endpoints/tasks.py index 8a7f901..c161e7e 100644 --- a/backend/app/api/v1/endpoints/tasks.py +++ b/backend/app/api/v1/endpoints/tasks.py @@ -38,6 +38,7 @@ async def list_tasks( skip: int = Query(0, ge=0), limit: int = Query(50, ge=1, le=200), db: AsyncSession = Depends(get_db), + current_user: dict = Depends(get_current_user), ): """获取任务列表,可按产品/负责人筛选(只返回顶层任务)""" pid = uuid.UUID(product_id) if product_id else None @@ -48,6 +49,7 @@ async def list_tasks( async def get_task( task_id: str, db: AsyncSession = Depends(get_db), + current_user: dict = Depends(get_current_user), ): """ 获取任务详情 — 递归包含所有层级的子任务。 @@ -299,6 +301,7 @@ async def create_subtask_endpoint( async def get_tasks_by_product( product_id: str, db: AsyncSession = Depends(get_db), + current_user: dict = Depends(get_current_user), ): """获取指定产品的顶层任务列表(不含子任务嵌套)""" return await task_service.get_top_level_tasks(db, uuid.UUID(product_id))