From 5242a36bf39a9c15ce8f5f07ed4ba20c0de134dc Mon Sep 17 00:00:00 2001 From: artemnto1 Date: Tue, 13 Jan 2026 13:41:08 +0100 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 92 ++----------------------------------------------------- 1 file changed, 2 insertions(+), 90 deletions(-) diff --git a/README.md b/README.md index 0c98afc..f1e4075 100644 --- a/README.md +++ b/README.md @@ -134,45 +134,8 @@ python -c "from bot import start_bot; import asyncio; asyncio.run(start_bot())" ### Vacancies - `GET /vacancies` - List all vacancies - -## Usage Flow - -1. **User visits website** → Calls `GET /login` -2. **Gets Telegram bot link** with unique token -3. **User clicks link** → Opens Telegram bot -4. **User sends `/start {token}`** to bot -5. **Bot validates token** → Updates status to "success" in DB -6. **Website polls** `GET /check-auth/{token}` → User authenticated! - -## Database Operations - -### Manual Database Operations - -```python -# Test database connection -python database/database.py - -# Initialize database -python init_db.py - -# Drop and recreate tables (⚠️ DELETES ALL DATA) -python init_db.py # Choose option 2 -``` - -### Using Database Sessions in Code - -```python -from database.database import get_db, User -from sqlalchemy import select -from fastapi import Depends - -@app.get("/example") -async def example_endpoint(db: AsyncSession = Depends(get_db)): - # Query users - result = await db.execute(select(User).where(User.status == "success")) - users = result.scalars().all() - return users -``` + + ## Development @@ -192,57 +155,6 @@ async def example_endpoint(db: AsyncSession = Depends(get_db)): └── docker-compose.yml # Docker services ``` -### Testing - -```bash -# Install test dependencies -pip install pytest pytest-asyncio httpx - -# Run tests -pytest tests/ -v - -# Test specific file -pytest tests/test_bot.py -v -``` - -## Troubleshooting - -### PostgreSQL Connection Issues -```bash -# Check if PostgreSQL is running -docker ps | grep postgres - -# Check connection -psql -h localhost -U postgres -d rag_ai_assistant -``` - -### MinIO Connection Issues -```bash -# Check if MinIO is running -docker ps | grep minio - -# Access MinIO console -open http://localhost:9001 -``` - -### Database Migration -```bash -# If you need to reset the database -python init_db.py # Choose option 2 (reset) -``` - -## Production Considerations - -1. **Security** - - Change default passwords in `.env` - - Use environment-specific configurations - - Enable SSL/TLS for PostgreSQL - - Implement rate limiting - -2. **Performance** - - Adjust SQLAlchemy pool settings - - Add database indexes as needed - - Implement caching (Redis) 3. **Monitoring** - Add logging