Add drafts & feedback tab to case page, remove global feedback page
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 32s

Move draft management (export DOCX, download, upload revised version, mark
final) and chair feedback into a new "טיוטות והערות" tab on the case detail
page. Remove the standalone /feedback page and its nav link since feedback
is now case-scoped.

Also fix /api/admin/skills 500 error when Paperclip DB is unreachable by
adding a connection timeout and graceful fallback to disk-only skills.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 05:55:46 +00:00
parent ce61b88438
commit 140a2e442d
7 changed files with 612 additions and 339 deletions

View File

@@ -1102,7 +1102,23 @@ async def api_case_create(req: CaseCreateRequest):
practice_area=req.practice_area,
appeal_subtype=req.appeal_subtype,
)
return json.loads(result)
parsed = json.loads(result)
# Auto-create Paperclip project for the new case
appeal_type = req.appeal_subtype or "רישוי"
try:
pc_result = await pc_create_project(
case_number=req.case_number,
title=req.title,
appeal_type=appeal_type,
)
parsed["paperclip"] = pc_result
logger.info("Auto-created Paperclip project for case %s: %s", req.case_number, pc_result.get("url"))
except Exception as e:
logger.warning("Failed to auto-create Paperclip project for case %s: %s", req.case_number, e)
parsed["paperclip_error"] = str(e)
return parsed
@app.get("/api/cases/{case_number}/details")
@@ -2091,15 +2107,20 @@ SKILLS_COMPANY_ID = os.environ.get("PAPERCLIP_COMPANY_ID", "42a7acd0-30c5-4cbd-a
@app.get("/api/admin/skills")
async def api_list_skills():
"""List installed Paperclip skills with DB sync status."""
conn = await asyncpg.connect(PAPERCLIP_DB_URL)
rows = []
try:
rows = await conn.fetch(
"SELECT slug, name, length(markdown) as md_chars, file_inventory, updated_at "
"FROM company_skills WHERE company_id = $1::uuid ORDER BY slug",
SKILLS_COMPANY_ID,
)
finally:
await conn.close()
conn = await asyncpg.connect(PAPERCLIP_DB_URL, timeout=5)
try:
rows = await conn.fetch(
"SELECT slug, name, length(markdown) as md_chars, file_inventory, updated_at "
"FROM company_skills WHERE company_id = $1::uuid ORDER BY slug",
SKILLS_COMPANY_ID,
)
finally:
await conn.close()
except (OSError, asyncpg.PostgresError, asyncpg.InterfaceError, TimeoutError):
# Paperclip DB unreachable — continue with disk-only skills
pass
skills = []
for r in rows: