feat(api): DELETE /api/projects/:id + store.deleteProject(连带 tasks/runs/events)
新增项目删除能力:store.deleteProject 事务内删 events(无 FK,手动)+ projects(tasks/runs/ approvals 经 schema ON DELETE CASCADE 连带清);DELETE /api/projects/:id 暴露之。 store.test 覆盖连带清除 + 重复删报错。用于清理 cutover 测试遗留的一次性 smoke-test 项目 (本次经直连 DB 删除,未重启打断在跑的 worker;端点下次重启生效)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -92,6 +92,13 @@ export function buildServer(opts: ApiOptions): FastifyInstance {
|
||||
return store.reorderProjects(b.order.map(String)).map(projectOut);
|
||||
});
|
||||
|
||||
// 彻底删除项目(连带 tasks/runs/approvals/events,不可恢复)
|
||||
app.delete('/api/projects/:id', (req) => {
|
||||
const { id } = req.params as { id: string };
|
||||
store.deleteProject(id);
|
||||
return { ok: true };
|
||||
});
|
||||
|
||||
// 项目 logo:仓库内文件 → 流式返回;外链头像 → 302;无 → 404(前端用首字母徽章兜底)
|
||||
app.get('/api/projects/:id/logo', async (req, reply) => {
|
||||
const { id } = req.params as { id: string };
|
||||
|
||||
Reference in New Issue
Block a user