添加后端集成测试套件
- 实现 82 个集成测试用例覆盖所有 API 端点 - 使用真实数据库连接,无 mock 逻辑 - 修复 PUT 请求只更新提供字段的逻辑 - 配置 Vitest 串行执行避免测试竞态 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6df528f187
commit
697430feed
18 files changed
+4333
-8
No files matched your search
@@ -118,9 +118,18 @@ export async function topicRoutes(app: FastifyInstance): Promise<void> {
|
||||
throw new NotFoundError('主题不存在');
|
||||
}
|
||||
|
||||
// 构建更新数据对象,只包含提供的字段
|
||||
const updateData: any = {};
|
||||
if (name !== undefined) updateData.name = name;
|
||||
if (description !== undefined) updateData.description = description;
|
||||
if (processMode !== undefined) updateData.processMode = processMode;
|
||||
if (llmConfigId !== undefined) updateData.llmConfigId = llmConfigId;
|
||||
if (scheduleConfig !== undefined) updateData.scheduleConfig = scheduleConfig;
|
||||
if (enabled !== undefined) updateData.enabled = enabled;
|
||||
|
||||
const topic = await prisma.topic.update({
|
||||
where: { id: parseInt(id) },
|
||||
data: { name, description, processMode, llmConfigId, scheduleConfig, enabled },
|
||||
data: updateData,
|
||||
});
|
||||
|
||||
// 更新数据源关联
|
||||
|
||||
Reference in new issue
Block a user