Fix Paperclip integration (identifier→issue_prefix) + add settings page
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 34s

- Fix column name mismatch in paperclip_client.py and app.py: Paperclip's
  companies table uses `issue_prefix`, not `identifier`
- Fix _LEGAL_DB_URL to read from POSTGRES_URL env var (used in container)
- Add settings page (/settings) for managing tag → Paperclip company mappings
- Replace "תיק חדש" nav item with "הגדרות" (new case is on home page)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 14:09:08 +00:00
parent b755620542
commit 1133272e34
5 changed files with 316 additions and 9 deletions

View File

@@ -40,7 +40,7 @@ _FALLBACK_APPEAL_TYPE_TO_COMPANY = {
}
# Legal-AI DB URL for reading tag_company_mappings
_LEGAL_DB_URL = os.environ.get(
_LEGAL_DB_URL = os.environ.get("POSTGRES_URL") or os.environ.get(
"DATABASE_URL", "postgresql://legal:legal@127.0.0.1:5432/legal_ai"
)
@@ -76,11 +76,11 @@ async def create_project(
conn = await asyncpg.connect(PAPERCLIP_DB_URL)
try:
# Resolve prefix from company identifier in Paperclip DB
# Resolve prefix from company issue_prefix in Paperclip DB
comp_row = await conn.fetchrow(
"SELECT identifier FROM companies WHERE id = $1::uuid", company_id,
"SELECT issue_prefix FROM companies WHERE id = $1::uuid", company_id,
)
prefix = comp_row["identifier"] if comp_row and comp_row["identifier"] else "CMP"
prefix = comp_row["issue_prefix"] if comp_row and comp_row["issue_prefix"] else "CMP"
# Check for existing project with this case number
existing = await conn.fetchrow(
@@ -244,9 +244,9 @@ async def get_project_url(case_number: str) -> str | None:
)
if row:
comp_row = await conn.fetchrow(
"SELECT identifier FROM companies WHERE id = $1::uuid", str(row["company_id"]),
"SELECT issue_prefix FROM companies WHERE id = $1::uuid", str(row["company_id"]),
)
prefix = comp_row["identifier"] if comp_row and comp_row["identifier"] else "CMP"
prefix = comp_row["issue_prefix"] if comp_row and comp_row["issue_prefix"] else "CMP"
return f"https://pc.nautilus.marcusgroup.org/{prefix}/projects/{row['id']}/issues"
return None
finally: