Shared Components: - Add CompanySelector.vue and PeriodSelector.vue components - Add AppHeader.vue and SlideMenu.vue layout components - Add shared stores factories (companies.js, accountingPeriod.js) - Add shared routes factories (companies.py, calendar.py) - Add shared models (company.py, calendar.py) - Add shared layout styles (header.css, navigation.css) Data Entry App: - Update CLAUDE.md with prod/test server documentation - Improve nomenclature sync service with better error handling - Update receipts router and CRUD operations - Add company/period stores using shared factories - Update App.vue layout with shared components - Fix OCRUploadZone file handling Reports App: - Refactor stores to use shared factories - Update App.vue to use shared layout components Infrastructure: - Replace start-data-entry.sh with separate dev/test scripts - Add .claude/rules for authentication, backend patterns, etc. - Add implementation plan for OCR receipt improvements - Clean up old documentation files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1.2 KiB
1.2 KiB
paths: {reports-app,data-entry-app}/backend/**/*.py
Backend Patterns
Router Factory Pattern
Use shared router factories instead of custom implementations:
from shared.routes.companies import create_companies_router
from shared.routes.calendar import create_calendar_router
companies_router = create_companies_router(oracle_pool, cache_decorator=cached)
app.include_router(companies_router, prefix="/api/companies")
Database Queries
- All queries use parameterized Oracle queries (no SQL injection)
- Schema lookup:
SELECT SCHEMA FROM CONTAFIN_ORACLE.V_NOM_FIRME - Company access: Join V_NOM_FIRME with VDEF_UTIL_FIRME
Caching (reports-app)
- Use
@cacheddecorator fromapp/cache/decorators - Place logic in services, not routers
- Cache schema lookups (24h TTL)
- Cache user data (10-30 min TTL)
Error Handling
try:
# Business logic
except HTTPException:
raise # Re-raise HTTP exceptions
except Exception as e:
logger.error(...)
raise HTTPException(500, "Internal error")
Oracle Pool Pattern
async with oracle_pool.get_connection() as connection:
with connection.cursor() as cursor:
cursor.execute(query, params)