feat(upload): חסימת כפילות בהעלאת פסיקה + banner עם אפשרויות
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m38s

- בקאנד: GET לפני ה-async task — אם citation כבר קיים כ-external_upload מחזיר 409
- DB: get_external_case_law_by_citation — lookup לפי citation + source_kind
- פרונט: banner אדום עם פרטי הרשומה הקיימת ושני כפתורות:
  • "הפעל חילוץ מחדש" — request-halachot ל-ID הקיים וסגירת הטופס
  • "מחק את הרשומה" — DELETE עם confirm, ניקוי conflict לאחר מכן

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-06 12:11:33 +00:00
parent c83d0162ca
commit 68a77c11b6
3 changed files with 155 additions and 67 deletions

View File

@@ -5328,6 +5328,21 @@ async def precedent_library_upload(
if not citation.strip():
raise HTTPException(400, "citation חובה")
# Reject re-upload of an already-manually-ingested citation so the
# chair can consciously choose between deletion and re-extraction.
existing = await db.get_external_case_law_by_citation(citation.strip())
if existing:
raise HTTPException(409, detail={
"error": "duplicate_external_upload",
"case_law_id": str(existing["id"]),
"citation": existing.get("case_number") or citation.strip(),
"case_name": existing.get("case_name") or "",
"court": existing.get("court") or "",
"date": (existing["date"].isoformat()
if existing.get("date") else None),
"halacha_extraction_status": existing.get("halacha_extraction_status") or "",
})
suffix = Path(file.filename or "").suffix.lower()
if suffix not in ALLOWED_EXTENSIONS:
raise HTTPException(400, f"סוג קובץ לא נתמך: {suffix}")