Consolidate 3 separate applications (reports-app, data-entry-app, telegram-bot) into a unified
architecture with single backend and frontend:
Backend Changes:
- Unified FastAPI backend at backend/ with modular structure
- Modules: reports, data_entry, telegram in backend/modules/
- Centralized config.py and main.py with all routers registered
- Single worker mode (--workers 1) for Telegram bot compatibility
- Shared Oracle connection pool and JWT authentication
- Unified requirements.txt and environment configuration
Frontend Changes:
- Single Vue.js SPA with module-based routing
- Unified frontend at src/ with modules in src/modules/{reports,data-entry}/
- Shared components and stores in src/shared/
- Error boundaries for module isolation
- Dual API proxy in Vite for module communication
Infrastructure:
- New unified startup scripts: start-prod.sh, start-test.sh, start-backend.sh
- Environment templates: .env.dev.example, .env.test.example, .env.prod.example
- Updated deployment scripts for Windows IIS
- Simplified SSH tunnel management
Documentation:
- Comprehensive CLAUDE.md with architecture overview
- Module-specific docs in docs/{data-entry,telegram}/
- Architecture decision records in docs/ARCHITECTURE-DECISIONS.md
- Deployment guides consolidated in deployment/windows/docs/
This migration reduces complexity, improves maintainability, and enables easier
deployment while maintaining all existing functionality.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
"""AccountingEntry SQLModel model for proposed accounting entries."""
|
|
|
|
from datetime import datetime
|
|
from decimal import Decimal
|
|
from enum import Enum
|
|
from typing import Optional, TYPE_CHECKING
|
|
|
|
from sqlmodel import SQLModel, Field, Relationship
|
|
|
|
if TYPE_CHECKING:
|
|
from .receipt import Receipt
|
|
|
|
|
|
class EntryType(str, Enum):
|
|
"""Type of accounting entry."""
|
|
DEBIT = "debit"
|
|
CREDIT = "credit"
|
|
|
|
|
|
class AccountingEntry(SQLModel, table=True):
|
|
"""Proposed accounting entry for a receipt."""
|
|
|
|
__tablename__ = "accounting_entries"
|
|
|
|
id: Optional[int] = Field(default=None, primary_key=True)
|
|
receipt_id: int = Field(foreign_key="receipts.id", index=True)
|
|
|
|
# Account
|
|
entry_type: EntryType
|
|
account_code: str = Field(max_length=20) # e.g., 6022, 5311, 4426
|
|
account_name: Optional[str] = Field(default=None, max_length=200) # Cache: "Cheltuieli combustibil"
|
|
|
|
# Amount
|
|
amount: Decimal = Field(decimal_places=2, max_digits=15)
|
|
|
|
# Analytics (optional)
|
|
partner_id: Optional[int] = Field(default=None)
|
|
cost_center_id: Optional[int] = Field(default=None)
|
|
|
|
# Entry metadata
|
|
is_auto_generated: bool = Field(default=True) # True if system-generated
|
|
modified_by: Optional[str] = Field(default=None, max_length=100) # Username if modified
|
|
modified_at: Optional[datetime] = Field(default=None)
|
|
|
|
# Order for display
|
|
sort_order: int = Field(default=0)
|
|
|
|
# Relationship
|
|
receipt: Optional["Receipt"] = Relationship(back_populates="entries")
|