v0.2.0: CRM/ERP 系统升级 - 清理 .gitignore 并移除误提交的 venv/env/db 文件
- 更新 .gitignore:全面覆盖环境变量、数据库、日志、缓存、上传文件 - 移除误跟踪的 server/venv/、crm_data.db、.env 文件 - 新增 server/.env.example 模板 - 新增合同管理、利润核算、AI教练等功能模块 - 新增 Playwright e2e 测试套件 - 前后端多项功能升级和 bug 修复
This commit is contained in:
@@ -4,7 +4,7 @@ CRM 客户模块路由 —— /api/customers
|
||||
"""
|
||||
from __future__ import annotations
|
||||
import uuid
|
||||
from fastapi import APIRouter, Depends, Query, Request
|
||||
from fastapi import APIRouter, Body, Depends, Query, Request
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from app.api.deps import get_current_user
|
||||
from app.db.database import get_db
|
||||
@@ -91,6 +91,20 @@ async def restore_customer(
|
||||
return ok(message="客户已恢复")
|
||||
|
||||
|
||||
@router.put("/{customer_id}/transfer", summary="转移客户负责人(仅管理员)")
|
||||
async def transfer_customer(
|
||||
customer_id: uuid.UUID,
|
||||
body: dict = Body(..., examples=[{"new_owner_id": "uuid-here"}]),
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: CurrentUserPayload = Depends(get_current_user),
|
||||
) -> dict:
|
||||
new_owner_id = body.get("new_owner_id")
|
||||
if not new_owner_id:
|
||||
raise Exception("缺少 new_owner_id 参数")
|
||||
result = await svc.transfer_customer(db, current_user, customer_id, uuid.UUID(str(new_owner_id)))
|
||||
return ok(data=result.model_dump(mode="json"), message="客户转移成功")
|
||||
|
||||
|
||||
@router.get("/{customer_id}/products", summary="获取客户关联产品(通过订单反查)")
|
||||
async def get_customer_products(
|
||||
customer_id: uuid.UUID,
|
||||
|
||||
Reference in New Issue
Block a user