feat: 初始化孕育无忧全栈项目基础代码结构

完成项目初始搭建,包含后端FastAPI+MongoDB服务、前端React+Vite项目的完整基础结构,添加各类配置文件与依赖清单,涵盖核心业务初始框架。
This commit is contained in:
2026-05-21 00:46:48 +08:00
commit 409dabafb5
142 changed files with 31010 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
"""
清理旧的共享 demo_web_user 及其关联数据。
部署新版 demo 登录逻辑后运行一次即可:
python -m scripts.cleanup_demo_users
"""
import asyncio
from motor.motor_asyncio import AsyncIOMotorClient
from beanie import init_beanie
from app.config import Settings
from app.models.user import User
from app.models.report import Report
from app.models.analysis import Analysis
from app.models.chat import ChatSession
from app.models.checkup import CheckupPlan
async def main():
settings = Settings()
client = AsyncIOMotorClient(settings.mongodb_url)
db = client[settings.database_name]
await init_beanie(database=db, document_models=[User, Report, Analysis, ChatSession, CheckupPlan])
user = await User.find_one(User.openid == "demo_web_user")
if not user:
print("未找到 demo_web_user,无需清理。")
return
uid = user.id
r = await Report.find(Report.user_id == uid).delete()
a = await Analysis.find(Analysis.user_id == uid).delete()
c = await ChatSession.find(ChatSession.user_id == uid).delete()
p = await CheckupPlan.find(CheckupPlan.user_id == uid).delete()
await user.delete()
print(f"已清理 demo_web_user (id={uid}):")
print(f" Reports: {r.deleted_count if r else 0}")
print(f" Analyses: {a.deleted_count if a else 0}")
print(f" ChatSessions: {c.deleted_count if c else 0}")
print(f" CheckupPlans: {p.deleted_count if p else 0}")
if __name__ == "__main__":
asyncio.run(main())