feat: 新增路由批量禁用/启用功能 (#295)
* feat: Preserve manual models during discovery and refresh, and add Claude configuration files and project documentation.feat: Preserve manual models during discovery and refresh, and add Claude configuration and project documentation files. * fix: fix Feishu and Larksuite webhook support to the notification service with updated UI and tests. * feat: 新增路由批量禁用/启用功能 - 后端新增 POST /api/routes/batch 接口,支持批量 enable/disable - 前端新增批量操作模式,支持 checkbox 选择路由 - 浮动操作栏显示选中数量,支持全选/取消全选 - 批量操作完成后自动退出选择模式并刷新列表 * fix: complete route batch actions on mobile --------- Co-authored-by: Xiang Li <xiangli> Co-authored-by: cita-777 <juricek.chen@gmail.com>
This commit is contained in:
@@ -154,4 +154,29 @@ describe('PUT /api/channels/batch', () => {
|
||||
expect(dbA?.manualOverride).toBe(true);
|
||||
expect(dbB?.manualOverride).toBe(true);
|
||||
});
|
||||
|
||||
it('reports the number of routes actually updated in route batch operations', async () => {
|
||||
const route = await db.insert(schema.tokenRoutes).values({
|
||||
modelPattern: 'gpt-4o-mini',
|
||||
enabled: true,
|
||||
}).returning().get();
|
||||
|
||||
const res = await app.inject({
|
||||
method: 'POST',
|
||||
url: '/api/routes/batch',
|
||||
payload: {
|
||||
ids: [route.id, route.id + 999],
|
||||
action: 'disable',
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.statusCode).toBe(200);
|
||||
expect(res.json()).toMatchObject({
|
||||
success: true,
|
||||
updatedCount: 1,
|
||||
});
|
||||
|
||||
const updatedRoute = await db.select().from(schema.tokenRoutes).where(eq(schema.tokenRoutes.id, route.id)).get();
|
||||
expect(updatedRoute?.enabled).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
+717
-672
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user