auto-sync: 2026-06-05 11:59:23
This commit is contained in:
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from fastapi import APIRouter, HTTPException, Query
|
||||
|
||||
from src.blackboard.registry import ProjectRegistry
|
||||
from src.utils import get_data_root
|
||||
@@ -104,16 +104,22 @@ async def archive_project(project_id: str):
|
||||
|
||||
|
||||
@router.delete("/{project_id}")
|
||||
async def delete_project(project_id: str):
|
||||
"""逻辑删除项目(status→deleted)"""
|
||||
async def delete_project(project_id: str, physical: bool = Query(False)):
|
||||
"""删除项目(默认逻辑删除,physical=true 物理删除)"""
|
||||
reg = _registry()
|
||||
# 检查项目存在
|
||||
info = reg.get_project(project_id)
|
||||
if not info:
|
||||
raise HTTPException(404, f"Project not found: {project_id}")
|
||||
if not reg.delete_project(project_id):
|
||||
raise HTTPException(500, "Delete failed")
|
||||
return {"ok": True}
|
||||
|
||||
if physical:
|
||||
result = reg.physical_delete_project(project_id)
|
||||
if not result:
|
||||
raise HTTPException(500, "Physical delete failed")
|
||||
return {"ok": True, "deleted": result}
|
||||
else:
|
||||
if not reg.delete_project(project_id):
|
||||
raise HTTPException(500, "Delete failed")
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
@router.patch("/{project_id}")
|
||||
|
||||
Reference in New Issue
Block a user