Обновить README.md

This commit is contained in:
artemnto1 2026-01-13 13:41:08 +01:00
parent 2c407d9e8d
commit 5242a36bf3

View File

@ -134,45 +134,8 @@ python -c "from bot import start_bot; import asyncio; asyncio.run(start_bot())"
### Vacancies ### Vacancies
- `GET /vacancies` - List all 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 ## Development
@ -192,57 +155,6 @@ async def example_endpoint(db: AsyncSession = Depends(get_db)):
└── docker-compose.yml # Docker services └── 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** 3. **Monitoring**
- Add logging - Add logging