Commit Graph

26 Commits

Author SHA1 Message Date
Claude Agent
b001b94e37 fix deploy 2026-02-24 10:09:19 +00:00
Claude Agent
30f55cf18b feat: Add A-Z filter for clients/suppliers in Telegram bot
- Add A-Z alphabetical filter keyboard for clients and suppliers lists
  (same pattern as company selection, without emoji)
- Increase clients/suppliers list pagination from 10 to 20 items per page
- Remove emoji from company A-Z filter button for consistency
- Add 6 new callback handlers: clients_alpha_menu, clients_alpha:LETTER,
  clients_alpha_page:PAGE:LETTER, and supplier equivalents
- Dashboard service and models updates
- Telegram bot: email handlers, auth, DB operations, internal API improvements
- Frontend: dashboard cards updates (CashFlow, Clienti, Furnizori, Treasury)
- Frontend: SolduriCompactCard and CollapsibleCard improvements
- DashboardView enhancements
- start.sh and run-with-restart.sh script updates
- IIS web.config and service worker updates

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-21 14:34:15 +00:00
Claude Agent
6718c956f7 feat: [US-004] Add SSH tunnel auto-start for Windows services
- Add ssh-tunnel.ps1: Windows SSH tunnel manager (equivalent to ssh-tunnel.sh)
  - Supports password auth via plink.exe (PuTTY)
  - Supports ssh_hostkey for non-interactive batch mode
  - Commands: start, stop, restart, status

- Add start-backend-service.ps1: NSSM service wrapper
  - Starts SSH tunnels before uvicorn
  - Waits for tunnel ports to be accessible (30s timeout)
  - Configured by Install-ROA2WEB.ps1

- Add start.ps1: Windows equivalent of start.sh
  - Orchestrates SSH tunnel + backend + frontend startup

- Add backend/shared/ssh_tunnel_manager.py: Python monitoring
  - Background asyncio task monitors tunnel health every 30s
  - Auto-restarts tunnels after 2 consecutive failures
  - Exposes status to /health endpoint

- Update ROA2WEB-Console.ps1:
  - Add Deploy-Scripts function
  - Update Update-ServiceToUseVenv to use wrapper script

- Fix PowerShell reserved variable ($PID -> $tunnelPid)
- Fix script path detection (scripts/ vs deployment/windows/scripts/)
- Update README.md with ssh_hostkey documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:04:26 +00:00
Claude Agent
8567f893bc feat: [US-003] Audit and document deploy script data preservation
- Add detailed logging in Deploy-Backend function for data/ preservation
- Update deployment/windows/README.md with "Data Preserved During Deploy" section
- Document data/ directory structure (receipts/, telegram/, cache/)
- Explain preservation mechanism (backup → deploy → restore)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 23:41:55 +00:00
Claude Agent
62f86250cc refactor(docs): consolidate and cleanup documentation
- Delete 9 deprecated/obsolete docs (~6,300 lines removed)
- Move test PDFs to tests/fixtures/ocr-samples/
- Create docs/DEPLOYMENT.md as principal guide
- Create tests/ocr-validation/README.md
- Update all refs for ultrathin monolith architecture
- Update OCR tests to use relative paths

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 09:14:51 +00:00
f1f6760bef refactor: Remove deprecated INTERNAL_API_PORT (ultrathin monolith cleanup)
Architecture cleanup after migration to ultrathin monolith:

- Remove INTERNAL_API_PORT from .env files (was port 8002)
- Clean up bot_main.py: remove uvicorn, Thread, run_internal_api()
- Update validate.md to check /api/telegram/health instead of port 8002
- Add deprecation notices to old Windows deployment docs
- Update docs/telegram/README.md with architecture note

The Telegram internal API is now served at /api/telegram/internal/*
on the main backend port (8000/8001) instead of separate port 8002.

Also includes: menu updates, ServerLogsView improvements, script fixes

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 03:56:27 +02: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
ce85e0643b fix: IIS sub-application deployment for production
Fixes 3 critical issues preventing production deployment on Windows IIS:

1. **IIS Sub-Application Path Stripping**
   - Changed URL patterns from ^roa2web/api/(.*) to ^api/(.*)
   - IIS sub-app at /roa2web automatically strips prefix
   - Requests arrive as /api/* not /roa2web/api/*

2. **SPA Fallback Absolute Path**
   - Changed from url="/index.html" to url="index.html"
   - Absolute paths (/) refer to site root, not sub-app
   - Relative path correctly serves from sub-app

3. **MIME Type Duplicates (500 Error)**
   - Added <remove> before <mimeMap> for .js, .json, .webmanifest
   - Prevents "duplicate collection entry" errors
   - Allows override of server-level MIME types

Build Script Improvements:
- Build-ROA2WEB.ps1: Copy public/ folder to temp build dir
- Build-ROA2WEB.ps1: Added verification logging for web.config
- ROA2WEB-Console.ps1: Fixed web.config verification location

Cleanup:
- Removed outdated web.config.10.0.20.36-INTERNAL
- Removed temporary test files and docs

Tested: https://roa2web.romfast.ro/roa2web/ - login page loads successfully

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 16:38:47 +02: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
3295f60faa feat: Improve Windows deployment and fix production paths
Data Entry App:
- Fix shared path finding for both dev and production environments
- Add base URL support for IIS subdirectory deployment (/data-entry/)
- Use import.meta.env.BASE_URL in router for correct path handling
- Add email-validator and python-jose dependencies

Deployment Scripts:
- Enhance Build-ROA2WEB.ps1 with improved build process
- Update ROA2WEB-Console.ps1 with Data Entry support
- Improve Publish-And-Deploy.ps1 deployment workflow
- Update deploy-config.json with new settings

Gitignore:
- Add more build cache patterns to ignore
- Add temp frontend build directories

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 19:44:15 +02:00
642ae3a96c docs: Add Windows OCR dependencies and fix IIS API error handling
- Add OCR installation instructions for Windows (Poppler, Tesseract, PaddleOCR)
- Add troubleshooting section for common OCR errors on Windows
- Fix web.config.data-entry to use existingResponse="Auto" instead of "Replace"
  This allows FastAPI JSON error responses to pass through IIS unchanged
- Update system requirements to recommend 16GB RAM for OCR workloads

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 19:43:33 +02:00
87859e5510 Add deployment automation system with build/publish workflow and fix path resolution
This commit introduces a complete deployment automation system for Windows Server deployment:

New Features:
- Publish-And-Deploy.ps1: Interactive console for building locally and transferring to server
  * Supports auto-detection of transfer method (Windows Share or SSH)
  * Configurable via deploy-config.json
  * Integrated with Build-ROA2WEB.ps1 for consistent builds
- Check-And-Deploy.ps1: Server-side auto-deployment script
  * Monitors transfer directory for new packages
  * Automatically deploys when new version detected
  * Integrates with ROA2WEB-Console.ps1 for deployment
- Setup-AutoDeploy.ps1: Configures scheduled task for auto-deployment
- DEPLOYMENT_AUTOMATION.md: Complete documentation for automation workflow

Bug Fixes:
- Fix path resolution in Publish-And-Deploy.ps1: Added Resolve-FullPath function to correctly resolve ../deploy-package path
- Fix ROA2WEB-Console.ps1 exit codes: Properly return boolean values and exit codes in non-interactive mode
- Fix Build-ROA2WEB.ps1 script copying: Added debug output and force deletion to avoid caching issues

Enhancements:
- ROA2WEB-Console.ps1: Support for ROA2WEB_SOURCE environment variable for flexible source paths
- Build-ROA2WEB.ps1: Enhanced debug output for troubleshooting script copying issues

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-14 14:59:47 +02:00
914ab0107e Fix Backend service PYTHONPATH for shared module imports
Fixed critical runtime error where backend service couldn't import
shared modules (ModuleNotFoundError: No module named 'database').

Changes:
- Updated Install-BackendFirstTime: Set PYTHONPATH to shared directory
  instead of parent directory
- Added Fix-BackendPythonPath.ps1: Quick fix script for existing
  installations

The backend imports 'from database.oracle_pool' which requires the
database module to be in PYTHONPATH. Previously PYTHONPATH pointed to
C:\inetpub\wwwroot\roa2web but the database module is located at
C:\inetpub\wwwroot\roa2web\shared\database. Now PYTHONPATH correctly
points to the shared directory.

For existing installations, run Fix-BackendPythonPath.ps1 as Administrator
to update the service configuration without reinstalling.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-12 02:46:02 +02:00
3adcb8f7b0 Add missing IIS configuration properties to global config
## Bug Fix

### Problem
IIS configuration failed with error:
```
[INSTALLATION FAILED] Cannot validate argument on parameter 'Name'.
The argument is null. Provide a valid value for the argument, and then try running the command again.
at Install-BackendFirstTime, line 643
```

The error occurred at line 643:
```powershell
Remove-WebAppPool -Name $Config.IISAppPoolName -ErrorAction SilentlyContinue
```

### Root Cause
Global configuration was missing IIS-related properties used in the IIS setup section:
- `$Config.IISAppPoolName` - used for Application Pool name (line 643, 646, 647)
- `$Config.IISSiteName` - used for IIS Site name (line 651, 653, 657)
- `$Config.IISAppName` - used for Web Application name (line 651, 653, 656)

When the script tried to use these null values, PowerShell validation failed.

### Solution
Added IIS configuration properties to `$script:Config` hashtable (lines 81-84):

```powershell
# IIS Configuration
IISSiteName = "Default Web Site"
IISAppName = "roa2web"
IISAppPoolName = "ROA2WEB-AppPool"
```

### Impact
- IIS Application Pool creation now works correctly
- Web Application is created under "Default Web Site" with path "/roa2web"
- Frontend files are served through IIS with proper app pool isolation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-12 02:35:05 +02:00
6c71f73740 Fix missing config properties for Windows services: add port, display name, and description
## Bug Fix

### Problem
Deployment failed with error:
```
[INSTALLATION FAILED] You cannot call a method on a null-valued expression.
at Install-BackendFirstTime, line 611
```

The error occurred at line 611:
```powershell
& nssm install $Config.BackendServiceName $pythonPath "-m" "uvicorn" ... "--port" $Config.BackendPort.ToString()
```

### Root Cause
Global configuration was missing required properties used by service installation functions:
- `$Config.BackendPort` - used in NSSM service creation (line 611)
- `$Config.BackendServiceDisplayName` - used for service display name (line 612)
- `$Config.BackendServiceDescription` - used for service description (line 613)
- `$Config.TelegramBotServiceDisplayName` - used in telegram bot service (line 816)
- `$Config.TelegramBotServiceDescription` - used in telegram bot service (line 817)
- `$Config.TelegramBotPort` - added for consistency (not yet used)

When the script tried to call `.ToString()` on `$Config.BackendPort`, it was null, causing the error.

### Solution
Added missing properties to `$script:Config` hashtable (lines 63-96):

**Backend properties:**
- `BackendPort = 8000`
- `BackendServiceDisplayName = "ROA2WEB Backend API"`
- `BackendServiceDescription = "FastAPI backend service for ROA2WEB application"`

**Telegram Bot properties:**
- `TelegramBotPort = 8002`
- `TelegramBotServiceDisplayName = "ROA2WEB Telegram Bot"`
- `TelegramBotServiceDescription = "Telegram bot frontend for ROA2WEB application"`

### Impact
- Backend service creation now works correctly with proper port configuration
- Service display names and descriptions are properly set in Windows Services
- Configuration is now complete and consistent

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-12 02:32:50 +02:00
ad5a16b8a3 Fix null reference error in first-time installation: move $pythonPath definition before service creation
## Bug Fix

### Problem
Backend deployment failed with error:
```
[INSTALLATION FAILED] You cannot call a method on a null-valued expression.
at Install-BackendFirstTime, line 609
```

The error occurred because `$pythonPath` was being used in service creation (line 609), but it was defined inside the `if (Test-Path $requirementsPath)` block. If requirements.txt didn't exist (or for any reason the block was skipped), the variable would be null when used later.

### Root Cause
Variable scope issue - paths were defined inside the requirements check block:
```powershell
# Before (WRONG):
if (Test-Path $requirementsPath) {
    $pipPath = Join-Path $venvPath "Scripts\pip.exe"
    $pythonPath = Join-Path $venvPath "Scripts\python.exe"  # Only defined if requirements exists!
    ...
}
# Later:
& nssm install ... $pythonPath ...  # ERROR: $pythonPath is null!
```

### Solution
Moved path definitions BEFORE the if block to ensure they're always available:
```powershell
# After (CORRECT):
$pipPath = Join-Path $venvPath "Scripts\pip.exe"
$pythonPath = Join-Path $venvPath "Scripts\python.exe"  # Always defined
$requirementsPath = Join-Path $Config.BackendPath "requirements.txt"

if (Test-Path $requirementsPath) {
    # Use the paths here
}
# Later:
& nssm install ... $pythonPath ...  # OK: $pythonPath is defined
```

### Changes
- `Install-BackendFirstTime`: Moved `$pipPath`, `$pythonPath`, `$requirementsPath` definitions outside the if block
- `Install-TelegramBotFirstTime`: Applied the same fix to prevent future issues

### Tested
This ensures paths are always available for service creation, regardless of whether requirements.txt exists or the if block executes.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-12 02:29:57 +02:00
09a368355d Complete Windows deployment console FULL INTEGRATION with auto-detection
This commit completes the unified Windows deployment console with automatic detection of first-time install vs update, eliminating the need for separate Install-*.ps1 scripts.

## Changes

### Added Detection Functions
- `Test-BackendInstalled`: Checks if backend is installed (venv + service + requirements.txt)
- `Test-TelegramBotInstalled`: Checks if telegram bot is installed (venv + service + app files)

### Added Prerequisite Installation Functions
- `Install-Chocolatey`: Automated Chocolatey package manager installation
- `Install-Python`: Python 3.11 installation via Chocolatey
- `Install-NSSM`: NSSM (Windows service manager) installation via Chocolatey
- `Install-IISModules`: IIS and required modules (URL Rewrite, Application Initialization)

### Added First-Time Installation Functions
- `Install-BackendFirstTime`: Complete backend first-time installation (~240 lines)
  - Directory structure creation
  - Backend, frontend, shared files copying with exclusions
  - .env.example template copying
  - Virtual environment creation with proper pip installation
  - Windows Service creation via NSSM
  - IIS Application Pool and Web Application configuration

- `Install-TelegramBotFirstTime`: Complete telegram bot first-time installation (~155 lines)
  - Directory structure (app, data, logs, temp, backups)
  - App files and requirements.txt copying
  - Virtual environment creation
  - Windows Service creation via NSSM

### Updated Deployment Functions with Auto-Routing
- `Deploy-Backend`: Now calls `Test-BackendInstalled` first
  - If NOT installed → routes to `Install-BackendFirstTime`
  - If installed → proceeds with existing UPDATE logic (backup, stop, update, start)

- `Deploy-TelegramBot`: Now calls `Test-TelegramBotInstalled` first
  - If NOT installed → routes to `Install-TelegramBotFirstTime`
  - If installed → proceeds with existing UPDATE logic (backup, stop, update, start)

## Benefits

1. **Single Entry Point**: Users can run the same deploy command for both first-time install and updates
2. **No Separate Install Scripts**: Eliminates confusion between Install-*.ps1 and Deploy-*.ps1
3. **Automatic Detection**: Intelligently detects what needs to be done
4. **Safer Updates**: Always checks if components exist before attempting updates
5. **Better UX**: Clear warnings about first-time installation vs updates

## Usage

```powershell
# Interactive (auto-detects install vs update)
.\ROA2WEB-Console.ps1
# Select: Deploy Components > Backend + Frontend

# Command line (auto-detects install vs update)
.\ROA2WEB-Console.ps1 -NonInteractive -Action DeployBackend
.\ROA2WEB-Console.ps1 -NonInteractive -Action DeployTelegramBot
.\ROA2WEB-Console.ps1 -NonInteractive -Action DeployAll
```

The console will automatically:
- Detect if backend/telegram-bot are installed
- Perform first-time installation if needed (including prerequisites)
- Perform updates if already installed (with automatic backups)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-12 02:23:59 +02:00
016c309d70 Optimize Windows deployment scripts: build cache, console integration, and .env.example handling
Build-ROA2WEB.ps1 improvements:
- Add intelligent npm node_modules caching (saves 2-5 minutes on repeated builds)
- Cache stored outside deploy-package in .build-cache/ directory
- Add Clean Cache menu option ([C]) and -CleanCache parameter
- Include ROA2WEB-Console.ps1 in deployment package
- Update README workflow to use unified console (interactive and CLI modes)
- Remove obsolete script references (Manage-ROA2WEB.ps1, Deploy-*.ps1)
- Fix .env.example copying for backend and telegram-bot (copy from source instead of hardcoded template)

ROA2WEB-Console.ps1 improvements:
- Fix PowerShell parsing error: ${ComponentName}: instead of $ComponentName:
- Add .env.example copying in Update-BackendFiles function
- Add .env.example copying in Update-TelegramBotFiles function
- Keep .env.example synchronized with development templates

.gitignore:
- Add .build-cache/ to prevent committing npm cache directory

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-12 02:04:31 +02:00
1832684aca Refactor Windows deployment scripts: unify build and management tools
Major improvements to deployment workflow with unified scripts and interactive menus.

New unified scripts:
- Build-ROA2WEB.ps1: Interactive menu for building all components
  * Isolated temp directory for frontend builds (prevents WSL node_modules corruption)
  * Automatic devDependencies installation (fixes Vite not found issue)
  * Auto-cleanup after build
  * Supports both interactive menu and non-interactive CLI

- ROA2WEB-Console.ps1: All-in-one deployment and management console
  * Interactive menus for deploy, manage services, and status checks
  * Automatic backups before deployment
  * Smart dependency updates (only if requirements.txt changed)
  * Health checks after service operations
  * Color-coded status output
  * Both interactive and non-interactive modes

Removed deprecated scripts (replaced by unified tools):
- Build-Frontend.ps1 → Use Build-ROA2WEB.ps1 -Component Frontend
- Build-TelegramBot.ps1 → Use Build-ROA2WEB.ps1 -Component TelegramBot
- Deploy-ROA2WEB.ps1 → Use ROA2WEB-Console.ps1 [Deploy menu]
- Deploy-TelegramBot.ps1 → Use ROA2WEB-Console.ps1 [Deploy menu]
- Manage-ROA2WEB.ps1 → Use ROA2WEB-Console.ps1 [Manage menu]

Updated documentation:
- Complete rewrite of scripts/README.md
- Clear workflow guides for first-time deployment and updates
- Comparison table v1.0 vs v2.0
- Updated best practices and troubleshooting

Benefits:
 Reduced from 13 to 8 scripts (better maintainability)
 Interactive menus for better UX
 Fixed WSL node_modules corruption issue
 Smart dependency management (faster deployments)
 Unified interface reduces learning curve
 Better error handling and health checks

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-12 01:35:14 +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
87bda52524 Fix ConnectError handling in Telegram bot API client
Fix AttributeError crash when backend is unreachable during account linking.
Previously, when telegram bot couldn't connect to backend, the error handler
tried to access e.response.status_code on a ConnectError exception which
doesn't have a response attribute.

Changes to reports-app/telegram-bot/app/api/client.py:
- Import ConnectError from httpx
- Add separate exception handler for ConnectError before HTTPError handler
- Log clear error message indicating backend connectivity issue
- Return None gracefully instead of crashing with AttributeError

Changes to deployment/windows/docs/TELEGRAM_BOT_TROUBLESHOOTING.md:
- Add new section "Problem: Cannot connect to backend / Connection Errors"
- Add diagnostic steps for backend service verification
- Add checklist for BACKEND_URL configuration (http://localhost:8000)
- Add Issue 5: Backend Service Not Running
- Add Issue 6: Wrong Backend URL in Telegram Bot
- Include PowerShell commands for Windows Server troubleshooting

This fix ensures the Telegram bot provides clear error messages when backend
is unavailable instead of crashing, making debugging easier for production
deployments.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 00:12:57 +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
b97a650fb4 Fix Windows deployment scripts for missing Python dependencies
Issues fixed:
1. Build-Frontend.ps1: Add verification that requirements.txt is included in deployment package
   - Prevents incomplete packages that cause ModuleNotFoundError on server
   - Throws error if critical files are missing before package is transferred

2. Deploy-ROA2WEB.ps1: Auto-detect first deployment and force install dependencies
   - Automatically sets ForceInstallDependencies=true on first deployment
   - Add -ForceInstallDependencies parameter for manual override
   - Better error handling and validation for pip install
   - Shows clear error messages with manual recovery instructions

This fixes the "ModuleNotFoundError: No module named 'httpx'" error that occurred
when deploying to Windows Server without explicitly forcing dependency installation.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 23:53:56 +02:00
f42eff71a6 Fix .gitignore and add missing authentication source files
This commit fixes overly broad .gitignore patterns that were excluding
important source code files from version control. Previously, wildcard
patterns like *auth*, *token*, *secret*, *connection*, and *credential*
were excluding ALL files containing these words, including critical
application code.

Changes:
- Updated .gitignore with specific patterns for sensitive config files
  (*.json, *.txt, *.yml, *.yaml extensions only)
- Removed broad wildcards that excluded source code files

Added missing source files:
- shared/auth/ (9 files): Complete authentication system
  - JWT handler, middleware, auth service, models, routes
- reports-app/backend/app/routers/auth.py: Authentication API router
- reports-app/backend/app/auth_middleware_wrapper.py: Middleware wrapper
- reports-app/frontend/src/stores/auth.js: Vue.js auth store
- reports-app/frontend/tests/: E2E tests and fixtures for auth
- reports-app/telegram-bot/app/auth/: Telegram auth linking module
- deployment/windows/scripts/Setup-ClaudeAuth.ps1: Windows deployment script
- security/secrets_scanner.py: Security scanning utility

These files are essential for the application to function and should
have been included in the initial commit.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 15:02:28 +03: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