fix: PostgreSQL compatibility and Telegram bot token validation

- Fixed PostgreSQL 18+ compatibility by using postgres:17 image
- Added token validation for Telegram bot
- Improved error handling in telegram_bot.py
- Added scripts for bot token management
- Cleaned up old QR codes and added new utility files
This commit is contained in:
2025-11-23 21:23:51 +09:00
parent 7ce0c6c62a
commit 37d7fc74b8
89 changed files with 251 additions and 19 deletions

48
endpoint_test.sh Executable file
View File

@@ -0,0 +1,48 @@
#!/bin/bash
BASE_URL="http://localhost:8002/auth"
EMAIL="testuser@example.com"
PASSWORD="secret123"
echo "1⃣ Регистрация пользователя..."
curl -s -X POST "$BASE_URL/register" \
-H "Content-Type: application/json" \
-d "{\"email\": \"$EMAIL\", \"password\": \"$PASSWORD\"}" | tee response_register.json
echo -e "\n"
USER_ID=$(jq .id response_register.json)
echo "2⃣ Аутентификация..."
curl -s -X POST "$BASE_URL/login" \
-H "Content-Type: application/json" \
-d "{\"email\": \"$EMAIL\", \"password\": \"$PASSWORD\"}" | tee response_login.json
echo -e "\n"
TOKEN=$(jq -r .access_token response_login.json)
echo "🔐 Получен токен: $TOKEN"
AUTH_HEADER="Authorization: Bearer $TOKEN"
echo "3⃣ Получение текущего пользователя (/me)..."
curl -s -X GET "$BASE_URL/me" -H "$AUTH_HEADER" | tee response_me.json
echo -e "\n"
echo "4⃣ Получение списка всех пользователей..."
curl -s -X GET "$BASE_URL/users" | tee response_users.json
echo -e "\n"
echo "5⃣ Получение пользователя по ID ($USER_ID)..."
curl -s -X GET "$BASE_URL/users/$USER_ID" | tee response_user.json
echo -e "\n"
echo "6⃣ Обновление пользователя..."
curl -s -X PUT "$BASE_URL/users/$USER_ID" \
-H "Content-Type: application/json" \
-d "{\"email\": \"updated_$EMAIL\", \"role\": \"admin\"}" | tee response_update.json
echo -e "\n"
echo "7⃣ Удаление пользователя..."
curl -s -X DELETE "$BASE_URL/users/$USER_ID" | tee response_delete.json
echo -e "\n"
echo "✅ Тест завершён."