fix: resolve architecture validation violations

- Add invoice exceptions module with proper exception hierarchy
- Replace HTTPException with service-layer exceptions in invoice API
- Add InvoicePDFGeneratedResponse and InvoiceStatsResponse Pydantic models
- Replace db.commit() with db.flush() in services for proper transaction control
- Update invoice service to use exceptions from app/exceptions/invoice.py

All 14 errors and 14 warnings are now resolved. Validation passes with
only INFO-level findings.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-24 18:23:49 +01:00
parent 6232bb47f6
commit 319fba5d39
7 changed files with 276 additions and 147 deletions

View File

@@ -97,7 +97,7 @@ class InvoicePDFService:
# Update invoice record with PDF path and timestamp
invoice.pdf_path = str(pdf_path)
invoice.pdf_generated_at = datetime.now(UTC)
db.commit()
db.flush()
return str(pdf_path)
@@ -151,7 +151,7 @@ class InvoicePDFService:
# Clear PDF fields
invoice.pdf_path = None
invoice.pdf_generated_at = None
db.commit()
db.flush()
return True