Platform Infrastructure - 8 Core Modules Completed: - Storage Service (LocalAdapter + OSSAdapter stub) - Logging System (Winston + JSON format) - Cache Service (MemoryCache + Redis stub) - Async Job Queue (MemoryQueue + DatabaseQueue stub) - Health Check Endpoints (liveness/readiness/detailed) - Database Connection Pool (with Serverless optimization) - Environment Configuration Management - Monitoring Metrics (DB connections/memory/API) Key Features: - Adapter Pattern for zero-code environment switching - Full backward compatibility with legacy modules - 100% test coverage (all 8 modules verified) - Complete documentation (11 docs updated) Technical Improvements: - Fixed duplicate /health route registration issue - Fixed TypeScript interface export (export type) - Installed winston dependency - Added structured logging with context support - Implemented graceful shutdown for Serverless - Added connection pool optimization for SAE Documentation Updates: - Platform infrastructure planning (04-骞冲彴鍩虹璁炬柦瑙勫垝.md) - Implementation report (2025-11-17-骞冲彴鍩虹璁炬柦瀹炴柦瀹屾垚鎶ュ憡.md) - Verification report (2025-11-17-骞冲彴鍩虹璁炬柦楠岃瘉鎶ュ憡.md) - Git commit guidelines (06-Git鎻愪氦瑙勮寖.md) - Added commit frequency rules - Updated 3 core architecture documents Code Statistics: - New code: 2,532 lines - New files: 22 - Updated files: 130+ - Test pass rate: 100% (8/8 modules) Deployment Readiness: - Local environment: 鉁?Ready - Cloud environment: 馃攧 Needs OSS/Redis dependencies Next Steps: - Ready to start ASL module development - Can directly use storage/logger/cache/jobQueue Tested: Local verification 100% passed Related: #Platform-Infrastructure
99 lines
1.5 KiB
Markdown
99 lines
1.5 KiB
Markdown
# 测试用户初始化说明
|
||
|
||
## 问题
|
||
创建知识库时报错 "User not found",因为数据库中没有用户记录。
|
||
|
||
## 解决方案
|
||
|
||
### 方法1:运行批处理脚本(推荐)⭐
|
||
|
||
双击运行:**`初始化测试用户.bat`**
|
||
|
||
这个脚本会自动创建两个测试用户:
|
||
- 普通用户(user-mock-001)
|
||
- 管理员用户(user-admin-001)
|
||
|
||
### 方法2:手动运行命令
|
||
|
||
```bash
|
||
cd backend
|
||
npm run prisma:seed
|
||
```
|
||
|
||
## 测试账号信息
|
||
|
||
### 普通用户
|
||
- **用户ID**: `user-mock-001`
|
||
- **邮箱**: `test@example.com`
|
||
- **密码**: `password123`
|
||
- **知识库配额**: 3个
|
||
- **试用期**: 30天
|
||
|
||
### 管理员用户
|
||
- **用户ID**: `user-admin-001`
|
||
- **邮箱**: `admin@example.com`
|
||
- **密码**: `password123`
|
||
- **知识库配额**: 10个
|
||
|
||
## 说明
|
||
|
||
1. **当前系统使用硬编码的用户ID**
|
||
- 后端控制器使用 `MOCK_USER_ID = 'user-mock-001'`
|
||
- 所有API请求都使用这个固定ID
|
||
|
||
2. **用户认证系统未实现**
|
||
- 当前处于开发阶段
|
||
- 用户登录/注册功能在里程碑3实现
|
||
|
||
3. **重新初始化数据库后需要重新运行seed**
|
||
- 如果执行了 `prisma migrate reset`
|
||
- 或手动清空了数据库
|
||
- 需要重新运行 `初始化测试用户.bat`
|
||
|
||
## 验证
|
||
|
||
运行seed脚本后,可以通过Prisma Studio验证:
|
||
|
||
```bash
|
||
npm run prisma:studio
|
||
```
|
||
|
||
在浏览器中打开,查看 `users` 表,应该能看到两个用户记录。
|
||
|
||
## 下一步
|
||
|
||
初始化完成后,就可以正常创建知识库了!🎉
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|