Fix: accept task_code/milestone_code as identifiers, add /config/status endpoint
- All /tasks/{task_id} endpoints now accept both numeric id and task_code string
- All /milestones/{milestone_id} endpoints (misc.py) now accept both numeric id and milestone_code
- Added _resolve_task() and _resolve_milestone() helpers
- GET /config/status reads initialization state from config volume (no wizard dependency)
- MilestoneResponse schema now includes milestone_code field
- Comments and worklog endpoints also accept task_code
This commit is contained in:
20
app/main.py
20
app/main.py
@@ -26,6 +26,26 @@ def health_check():
|
||||
def version():
|
||||
return {"name": "HarborForge", "version": "0.3.0", "description": "Agent/人类协同任务管理平台"}
|
||||
|
||||
@app.get("/config/status", tags=["System"])
|
||||
def config_status():
|
||||
"""Check if HarborForge has been initialized (reads from config volume).
|
||||
Frontend uses this instead of contacting the wizard directly."""
|
||||
import os, json
|
||||
config_dir = os.getenv("CONFIG_DIR", "/config")
|
||||
config_file = os.getenv("CONFIG_FILE", "harborforge.json")
|
||||
config_path = os.path.join(config_dir, config_file)
|
||||
if not os.path.exists(config_path):
|
||||
return {"initialized": False}
|
||||
try:
|
||||
with open(config_path, "r") as f:
|
||||
cfg = json.load(f)
|
||||
return {
|
||||
"initialized": cfg.get("initialized", False),
|
||||
"backend_url": cfg.get("backend_url"),
|
||||
}
|
||||
except Exception:
|
||||
return {"initialized": False}
|
||||
|
||||
# Register routers
|
||||
from app.api.routers.auth import router as auth_router
|
||||
from app.api.routers.tasks import router as tasks_router
|
||||
|
||||
Reference in New Issue
Block a user