11 Commits

Author SHA1 Message Date
5283bf2b85 fix: корректный договор по валюте и адреса контрагентов 2025-11-06 12:03:21 +03:00
a16ffca725 Refactor validator for zero-price detection and fix XML generator for 1C EnterpriseData 1.20 compatibility
- Enhanced validator with critical zero-price validation
- Fixed currency GUIDs and money formatting in XML generator
- Removed incompatible VidED field
- Added comprehensive documentation
- Updated test files
2025-11-06 09:03:35 +03:00
fda403603e Fix: критические исправления для XDTO-валидации 1С
Исправлены все блокирующие ошибки загрузки XML в 1С:

1. Очистка GUID от query-параметров (?expand=...)
   - Номенклатура: убран хвост ?expand=product.uom
   - Единицы измерения: убран хвост из href
   - Использован .split('?')[0] для получения чистого GUID

2. Убраны лишние пробелы из номера документа
   - Заменен .ljust(11) на .strip()
   - Предотвращение дублей/расхождений

3. Добавлены стандартные UUID для классификаторов
   - Единица измерения 'Штука (796)': cdf130e2-63a8-11e8-80dd-0050569f5448
   - Страна 'Россия (643)': 67700c1b-63a8-11e8-80dd-0050569f5448

4. Детерминированный UUID для договора
   - Генерация на основе контрагента и организации
   - Предотвращение ошибки 'Недопустимое значение параметра'

5. Удален дублирующий import uuid

Все изменения проверены по стандарту EnterpriseData 1.20
2025-11-06 07:30:40 +03:00
ad94c29bbd fix: корректная работа inline и reply кнопок после генерации документов, улучшена обработка состояний ConversationHandler, исправлен переход при повторной генерации 2025-11-05 15:09:59 +03:00
8e56415e68 chore: Add development tooling and automation
Makefile (20+ commands):

Development Docker Commands:
- make build: Build Docker image
- make up: Start containers
- make down: Stop containers
- make logs: Show logs
- make shell: Open bot shell
- make ps: Show container status

Production Docker Commands:
- make prod-build: Build and publish to registry
- make prod-up: Deploy production stack
- make prod-down: Stop production
- make prod-logs: Production logs
- make prod-ps: Production status
- make prod-restart: Restart services
- make prod-pull: Update images
- make prod-backup: Backup to /var/backups

Development Commands:
- make venv: Create virtual environment
- make install: Install dependencies
- make run: Run bot locally
- make test: Run tests
- make lint: Run linter
- make clean: Clean cache and temp files
- make backup: Backup data directory

Utility:
- make help: Show all commands with descriptions
2025-11-03 14:22:00 +03:00
9491811425 docs: Add comprehensive documentation
Documentation Structure:
- MULTI_USER_AUTH.md (250 lines): Multi-user authentication guide
  - Architecture overview
  - Encryption mechanism (Fernet/AES-128)
  - User flow diagrams
  - API reference
  - Security considerations

- MIGRATION_GUIDE.md (120 lines): Migration instructions
  - Single-user to multi-user migration
  - Step-by-step guide
  - Data backup procedures
  - Rollback instructions

- DOCKER_QUICKSTART.md (100 lines): Quick Docker start
  - Prerequisites
  - 5-minute setup guide
  - Common commands
  - Troubleshooting

- DOCKER_GUIDE.md (400 lines): Complete Docker guide
  - Architecture details
  - Development workflow
  - Volume management
  - Network configuration
  - Resource limits
  - Logging and debugging

- PRODUCTION_DEPLOYMENT.md (500 lines): Production operations
  - 7-service architecture diagram
  - Deployment procedures
  - Monitoring setup (Prometheus, Grafana)
  - Management commands
  - Backup/restore
  - Security checklist
  - Scaling strategies
  - Troubleshooting guide

- CHANGELOG.md: Version history and release notes
2025-11-03 14:21:39 +03:00
b7853637bc feat: Add CI/CD pipeline and deployment automation
GitHub Actions Workflow:
- Automatic build on push to main/develop
- Build on tags (v*.*.*)
- Multi-platform support (linux/amd64)
- Publish to ghcr.io registry
- Docker layer caching
- Metadata extraction for tags

Build Scripts (Linux + Windows):
- build-image.sh/bat: Build and publish to registry
- Registry authentication check
- Image testing before push
- Configurable registry (default: ghcr.io)

Deployment Scripts (Linux + Windows):
- deploy-prod.sh/bat: Production deployment automation
- Pre-deployment checks (.env.prod validation)
- Automatic backup before deploy
- Image pull and stack deployment
- Health check verification
- Rollback support
2025-11-03 14:21:19 +03:00
4800e8c375 feat: Add production Docker orchestration with monitoring
Production Stack (7 services):
- buh_bot: Main bot from registry (1 CPU, 1GB RAM)
- nginx: Reverse proxy with rate limiting (10 req/s)
- prometheus: Metrics collection (30d retention)
- grafana: Monitoring dashboards (port 3000)
- node_exporter: Host metrics (port 9100)
- cadvisor: Container metrics (port 8080)
- watchtower: Auto-updates (hourly check)

Configuration:
- docker-compose.prod.yml with 7-service stack
- nginx.conf with SSL-ready config and healthchecks
- prometheus.yml with scrape configs
- grafana datasource and dashboard provisioning
- .env.prod.example template
- Custom network 172.20.0.0/16
- Persistent volumes in /var/lib/buh_bot
- Log rotation: 50MB x 5 files
2025-11-03 14:20:48 +03:00
b75b8e62a6 feat: Add Docker containerization for development
- Add Dockerfile with Python 3.11-slim base
- Add docker-compose.yml for local development
- Add .dockerignore to optimize build context
- Add start/stop scripts for Linux and Windows
- Add .env.example template
- Configure volumes for data, logs, temp_documents
- Add healthcheck with 30s interval
- Resource limits: 0.5 CPU, 512MB RAM
2025-11-03 14:20:26 +03:00
e24ef22337 feat: Add multi-user authentication system
- Implement per-user МойСклад credentials storage
- Add Fernet encryption for passwords (AES-128)
- Add UserManager module for credential management
- Add /logout and /change_credentials commands
- Update bot.py with AUTH_LOGIN/AUTH_PASSWORD states
- Each user works with their own МойСклад account
- Credentials stored in encrypted users.json
2025-11-03 14:20:07 +03:00
5b6ab02e53 Initial commit: Core bot application
- Add main bot file with Telegram handlers
- Add configuration module
- Add Python dependencies
- Add modules: excel_generator, moysklad_client, xml_generator, user_manager
- Add .gitignore for Python, Docker, user data
2025-11-03 14:19:48 +03:00