Commit Graph

19 Commits

Author SHA1 Message Date
Claude Agent
b137e80b71 feat: multi-Oracle server support with runtime switching
Complete implementation of multi-server Oracle database support:

Backend:
- Multi-pool Oracle with lazy loading per server
- Email-to-server cache for automatic server discovery
- JWT tokens include server_id claim
- /auth/check-identity and /auth/check-email endpoints
- /auth/my-servers endpoint for listing user's accessible servers
- Server switch with password re-authentication

Frontend:
- New ServerSelector component for header dropdown
- Multi-step login flow (identity → server → password)
- Server switching from header with password modal
- Mobile drawer menu with server selection
- Dark mode support for all new components
- URL bookmark support with ?server= query param

Scripts:
- Unified start.sh replacing start-prod.sh/start-test.sh
- Unified ssh-tunnel.sh with multi-server support
- Updated status.sh for new architecture

Tests:
- E2E tests for multi-server and single-server login flows
- Backend unit tests for all new endpoints
- Oracle multi-pool integration tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 22:39:06 +00:00
Claude Agent
fcf2722974 refactor(docs): create troubleshooting folder, cleanup OCR docs
- Create docs/troubleshooting/ for debugging guides
- Move OCR_MEMORY_SOLUTIONS_RESEARCH.md → troubleshooting/OCR_MEMORY_LEAKS.md
- Delete outdated docs/data-entry/OCR_PROFILE_TEST_RESULTS.md
- Update CLAUDE.md documentation index with troubleshooting reference

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 09:21:07 +00:00
Claude Agent
7b3491b7b6 feat(unified-mobile-material-design): Complete US-117 - Actualizare CLAUDE.md cu reguli Mobile Development
Implemented by Ralph autonomous loop.
Iteration: 6

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-12 11:20:26 +00:00
Claude Agent
b4a226409c feat(data-entry): Add unified receipt form with OCR confidence tracking
New unified receipt creation system with:
- UnifiedReceiptForm component with inline OCR preview and confidence indicators
- Compact upload zone with drag-drop and camera support
- TVA and Payment fields with dynamic add/remove
- Supplier dual-field with autocomplete and OCR hint
- Receipt form sections with collapsible auxiliary data

Backend OCR improvements:
- Add confidence_tva and confidence_payment to extraction results
- Update TVA extraction to return confidence scores
- Include TVA (15%) and payment (10%) in overall_confidence calculation

Also includes:
- CSS design system rules documentation
- Port check helper function for service scripts
- Expanded design tokens documentation in CLAUDE.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 21:48:37 +00:00
Claude Agent
67b0082df0 docs: Restructure styling documentation and add theme toggle docs
- Simplify CLAUDE.md from ~460 to ~145 lines with imports
- Add Theme System section to css-design-system.md (3 modes: auto/light/dark)
- Document theme toggle UI, localStorage persistence, CSS priority order
- Add paths: frontmatter to authentication.md and company-period.md
- Update DESIGN_TOKENS.md Dark Mode section with toggle documentation
- Clean auto-build-memory.md header (remove non-existent auto-sync reference)
- Remove non-existent plugin from settings.json

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 14:58:24 +00:00
Claude Agent
bb72b690ab fix(ocr): Fix mobile file upload ERR_NETWORK on Android/iOS
Clone file to memory immediately after selection to avoid SnapshotState
invalidation in W3C File API. Android/iOS browsers invalidate File object
references after accessing properties (name, size, type).

See: https://issues.chromium.org/40703873

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 14:22:56 +00:00
Claude Agent
02a8c8682c feat: Add Linux deployment scripts and server logs view
- Add deployment/linux/ with deploy.sh for deploying from Claude-Agent LXC to Windows server
- Add ServerLogsView.vue for viewing server logs from frontend
- Add shared/routes/system.py for system health endpoints
- Update CLAUDE.md with quick deploy instructions
- Improve Windows deployment scripts (ROA2WEB-Console.ps1)
- Fix OCR service validation and worker pool improvements
- Update environment config examples
- Various script permission and startup fixes

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 00:26:36 +00:00
9008876b16 chore: Remove obsolete microservices directories and update all references
- Delete data-entry-app/ (1.6GB), reports-app/ (447MB), .auto-build-data/
- Saved ~1.4GB disk space (64% reduction: 2.2GB → 845MB)

Updated references across 38 files:
- .claude/rules/ paths: backend/modules/, src/modules/
- .claude/commands/validate.md: all validation paths
- docs/ (13 files): data-entry, telegram, README, CLAUDE.md
- scripts/ (3 files): backup-secrets, restore-secrets, test-docker
- security/ (2 files): git_cleanup, SECURITY_PROCEDURES
- deployment/ & shared/: updated all stale comments

All paths now reflect ultrathin monolith architecture:
- Backend: backend/modules/{reports,data_entry,telegram}/
- Frontend: src/modules/{reports,data-entry}/
- Shared: shared/{auth,database,routes}/

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 12:08:20 +02:00
c5e051ad80 feat: Migrate to ultrathin monolith architecture
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>
2025-12-29 23:48:14 +02:00
d507a81b0a feat: Implement unified Vue SPA with granular service control
Consolidate Reports and Data Entry apps into a single Vue.js SPA with:

Architecture:
- Module-based structure with lazy-loaded routes (@reports, @data-entry)
- Error boundaries per module to prevent cascade failures
- Dual API proxy in Vite for microservices (reports:8001, data-entry:8003)
- Pinia store factories for shared auth, company, and period stores
- Vite path aliases for clear module boundaries (@shared, @reports, @data-entry)

Service Management:
- Granular service control scripts (backend-reports.sh, backend-data-entry.sh, bot.sh, frontend.sh)
- 87% faster frontend restart: 7s vs 53s full restart
- 38% faster full startup: 33s vs 53s via parallel backend initialization
- Enhanced start-dev.sh with proper service timeouts (OCR: 30s, Vite: 15s, Bot: 10s)
- status.sh for comprehensive health checks

Features:
- Auto-select first company on login with period auto-load
- Hamburger menu with feature toggle support
- JWT token auto-injection via axios interceptors
- Unified header with company/period selectors
- IIS web.config for production deployment with multi-API routing

UX Improvements:
- Vue watchers for reactive company/period loading
- Lazy store initialization with graceful error handling
- Period persistence per user+company in localStorage
- Feature flags for optional modules

Deployment:
- Single IIS site serves unified frontend with API proxy rules
- Maintains separate backend processes for microservices
- Windows line ending fixes (.env CRLF → LF conversion)

Stats: 112 files changed, 38,342 insertions(+), 2,342 deletions(-)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 19:06:23 +02:00
c5fde510a8 feat: Add JWT auth and nomenclature sync to data-entry-app
Integrate shared JWT authentication into data-entry-app:
- Add Oracle pool initialization for auth service
- Add AuthenticationMiddleware to protect API routes
- Update all receipt endpoints to use CurrentUser from JWT
- Add shared auth router (/api/auth/login, /api/auth/refresh)

Add nomenclature synchronization feature:
- Create SQLite models for synced suppliers, local suppliers, and cash registers
- Add nomenclature router with sync triggers and CRUD endpoints
- Add sync service for Oracle → SQLite nomenclature data
- Update nomenclature_service to use synced SQLite data with fallbacks

Create shared frontend components:
- Add shared/frontend/ with LoginView.vue, auth store factory, login.css
- Integrate shared login and auth into data-entry-app frontend
- Add axios-based API service with token refresh interceptor

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 18:36:24 +02:00
5960154094 docs: Update CLAUDE.md with data-entry-app references
- Add application-specific instructions section
- Reference data-entry-app/CLAUDE.md for data entry work
- Update architecture diagram with both apps
- Add starting services commands for both apps
- Add data-entry documentation to Documentation Index
- Clarify when to use which instructions

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 17:46:25 +02:00
906c9b2724 feat: Improve trial balance display and PDF export with class totals
- Change totals display to single horizontal line using shared CSS
- Rename column headers from "Sold Prec" to "Sume Prec" (correct terminology)
- Add class totals (TOTAL CLASA 1-7) and grand total to PDF export
- Style class totals with light gray background, grand total with darker gray
- Update CLAUDE.md with rule to use shared CSS instead of creating new styles

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 16:33:04 +02:00
86900d7750 fix: Standardize Trial Balance table styling and add export functionality
- Refactor table columns from grouped (Debit+Credit vertical) to separate columns for better scannability
- Replace custom HTML buttons with PrimeVue Button components (icon + label)
- Move filter action buttons to separate row below filters (matches InvoicesView pattern)
- Add Excel and PDF export functionality that fetches ALL data (not just current page)
- Update CSS_PATTERNS.md with unified table column structure and filter button patterns
- Update CLAUDE.md with table styling requirements and anti-patterns

This ensures visual consistency across all table views in the application.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 01:50:41 +02:00
fff430acf0 feat: Add cache system documentation and refactor Trial Balance with caching
- Add comprehensive cache architecture to ARCHITECTURE_SCHEMA.md
  * Two-tier cache flow diagram (L1 Memory → L2 SQLite → Oracle)
  * Cache types & TTL configuration
  * Cache management endpoints and performance tracking

- Update CLAUDE.md with mandatory cache usage guidelines
  * Mark cache system as MANDATORY for new endpoints
  * Add complete service layer example with @cached decorator
  * Add cache best practices (DO's and DON'Ts)
  * Update Key Architectural Decisions section

- Update README.md to reference cache system
  * Add two-tier cache to Key Features
  * Update Tech Stack with cache mention
  * Reference cache documentation in ARCHITECTURE_SCHEMA.md

- Create trial_balance_service.py with caching
  * Service layer with @cached decorator (10 min TTL)
  * Schema lookup cached separately (24h TTL)
  * Cache key includes all filter parameters
  * Automatic L1 (Memory) + L2 (SQLite) caching

- Refactor trial_balance router to use service layer
  * Reduce code from 206 lines to 92 lines (-55%)
  * Remove direct Oracle queries from router
  * Delegate business logic to service
  * Add cache behavior documentation

- Add trial_balance cache type to config.py
  * TTL: 600 seconds (10 minutes) default
  * Configurable via CACHE_TTL_TRIAL_BALANCE env var

Benefits:
• 99% faster response time on cache hits (500ms → 1-5ms)
• 90%+ reduction in Oracle database load
• Consistent architecture (service pattern)
• Performance tracking and observability
• Automatic cache invalidation support

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 01:15:02 +02:00
2b2002bbe8 docs: optimize and streamline documentation (59% reduction)
Major documentation refactoring to eliminate duplications and improve maintainability:

CLAUDE.md (562→230 lines, 59% reduction):
- Eliminated duplicate content with README.md
- Added smart references to detailed documentation
- Streamlined "Common Development Tasks" with golden rules
- Created comprehensive "Documentation Index" as single source of truth
- Focused on AI-friendly quick reference patterns

README.md (402→251 lines, 37% reduction):
- Simplified Quick Start to single command
- Condensed Tech Stack to one-line summary with CLAUDE.md reference
- Merged "Development Commands" + "Testing" into compact section
- Updated Production Deployment with modern workflow (Publish-And-Deploy.ps1, ROA2WEB-Console.ps1)
- Added Frontend Styling & CSS documentation references

Key improvements:
- Zero duplications across documentation files
- Clear separation: README.md = quick start, CLAUDE.md = development guide
- Smart cross-references between docs
- Updated deployment section with current scripts
- Maintained all essential information while reducing context by 446 lines

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 23:56:03 +02:00
1b4e2e1f40 Refactor Windows deployment scripts: unify build and management tools
Major improvements to Windows deployment workflow:

 New Unified Scripts:
- Build-ROA2WEB.ps1: Single build script for all components (Frontend, Backend, TelegramBot)
  * Supports selective builds: -Component All|Frontend|Backend|TelegramBot
  * Replaces Build-Frontend.ps1 and Build-TelegramBot.ps1
  * Consistent output structure and better validation

- Manage-ROA2WEB.ps1: Unified service management
  * Single entry point for Start, Stop, Restart, Status actions
  * Supports -Component All|Backend|TelegramBot
  * Health checks and detailed status reporting
  * Replaces 6 separate Start/Stop/Restart scripts

🗑️ Removed Deprecated Scripts:
- Start-ROA2WEB.ps1, Stop-ROA2WEB.ps1, Restart-ROA2WEB.ps1
- Start-TelegramBot.ps1, Stop-TelegramBot.ps1, Restart-TelegramBot.ps1
(6 scripts → 1 unified Manage-ROA2WEB.ps1)

⚠️ Marked as DEPRECATED (backward compatibility):
- Build-Frontend.ps1 (use Build-ROA2WEB.ps1 -Component Frontend)
- Build-TelegramBot.ps1 (use Build-ROA2WEB.ps1 -Component TelegramBot)

🧹 Cleanup & Organization:
- Updated .gitignore: deploy-package/ and build artifacts excluded
- Removed deploy-package/ from git tracking (generated artifacts)
- Added DEPLOY_PACKAGE.md with generation instructions
- Created comprehensive scripts/README.md documentation

📝 Documentation Updates:
- Updated CLAUDE.md Windows deployment section
- Added complete script reference guide
- Migration guide from old scripts to new unified system

📊 Impact:
- 18 scripts → 11 scripts (39% reduction)
- ~10,000 LOC → ~6,500 LOC (35% reduction)
- Zero duplicate code
- Cleaner git repository (no build artifacts)
- Unified, consistent API across all operations

Migration:
./Build-Frontend.ps1        → ./Build-ROA2WEB.ps1 -Component Frontend
./Build-TelegramBot.ps1      → ./Build-ROA2WEB.ps1 -Component TelegramBot
./Start-ROA2WEB.ps1          → ./Manage-ROA2WEB.ps1 -Action Start -Component Backend
./Restart-TelegramBot.ps1    → ./Manage-ROA2WEB.ps1 -Action Restart -Component TelegramBot

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 22:50:03 +02:00
68459b5c7e Add Telegram Bot internal API configuration for Windows deployment
Fix issue where backend cannot communicate with Telegram bot service to save
authentication codes during account linking flow. This caused "link invalid or
expired" errors when users tried to link Telegram accounts.

Changes:
- Add TELEGRAM_BOT_INTERNAL_API environment variable to backend .env.example
  (defaults to http://localhost:8002 for local/Windows deployments)
- Update CLAUDE.md with Telegram Bot integration requirements for Windows
- Add comprehensive troubleshooting guide for Windows deployment at
  deployment/windows/docs/TELEGRAM_BOT_TROUBLESHOOTING.md

The troubleshooting guide includes:
- Diagnostic steps to verify service health and connectivity
- Common issues and solutions (port conflicts, firewall, wrong bot token)
- PowerShell commands for Windows Server administration
- Verification steps for end-to-end testing

This ensures proper backend-to-telegram-bot communication for the auth code
linking workflow in production Windows deployments.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 00:09:37 +02:00
6b13ffa183 Initial commit: ROA2WEB - FastAPI + Vue.js + Telegram Bot
Modern ERP Reports Application with microservices architecture

Tech Stack:
- Backend: FastAPI + python-oracledb (Oracle DB integration)
- Frontend: Vue.js 3 + PrimeVue + Vite
- Telegram Bot: python-telegram-bot + SQLite
- Infrastructure: Shared database pool, JWT authentication, SSH tunnel

Features:
- FastAPI backend with async Oracle connection pool
- Vue.js 3 responsive frontend with PrimeVue components
- Telegram bot alternative interface
- Microservices architecture with shared components
- Complete deployment support (Linux Docker + Windows IIS)
- Comprehensive testing (Playwright E2E + pytest)

Repository Structure:
- reports-app/ - Main application (backend, frontend, telegram-bot)
- shared/ - Shared components (database pool, auth, utils)
- deployment/ - Deployment scripts (Linux & Windows)
- docs/ - Project documentation
- security/ - Security scanning and git hooks
2025-10-25 14:55:08 +03:00