main commit
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-16 16:30:25 +09:00
parent 91c7e04474
commit 537e7b363f
1146 changed files with 45926 additions and 77196 deletions

View File

@@ -6,6 +6,26 @@ The Women's Safety App provides a comprehensive API for managing user profiles,
**Base URL:** `http://localhost:8000` (API Gateway)
## Swagger Documentation
Интерактивная документация API доступна через Swagger UI по следующим URL:
- API Gateway: `http://localhost:8000/docs`
- User Service: `http://localhost:8001/docs`
- Emergency Service: `http://localhost:8002/docs`
- Location Service: `http://localhost:8003/docs`
- Calendar Service: `http://localhost:8004/docs`
- Notification Service: `http://localhost:8005/docs`
- Nutrition Service: `http://localhost:8006/docs`
Документация в формате ReDoc доступна по адресам:
- API Gateway: `http://localhost:8000/redoc`
- User Service: `http://localhost:8001/redoc`
- (и т.д. для остальных сервисов)
> **Примечание**: Swagger-документация для каждого сервиса доступна только при запущенном соответствующем сервисе. Если сервис не запущен, страница документации будет недоступна.
## Authentication
All endpoints except registration and login require JWT authentication.
@@ -15,6 +35,29 @@ All endpoints except registration and login require JWT authentication.
Authorization: Bearer <jwt_token>
```
### Testing with Swagger UI
Для тестирования API через Swagger UI:
1. Запустите необходимые сервисы:
```bash
./start_services.sh
```
2. Откройте Swagger UI в браузере:
```
http://localhost:8000/docs
```
3. Получите JWT-токен через эндпоинты `/api/v1/auth/login` или `/api/v1/auth/register`
4. Авторизуйтесь в Swagger UI:
- Нажмите на кнопку "Authorize" в правом верхнем углу
- Введите полученный JWT-токен в формате: `Bearer <token>`
- Нажмите "Authorize"
5. Теперь вы можете тестировать все защищенные эндпоинты
## API Endpoints
### 🔐 Authentication
@@ -247,6 +290,109 @@ Authorization: Bearer <token>
}
```
### 🍎 Nutrition Services
#### Search Food Items
```http
GET /api/v1/nutrition/foods?query=apple
Authorization: Bearer <token>
```
**Response:**
```json
{
"results": [
{
"food_id": "123456",
"name": "Apple, raw, with skin",
"brand": "",
"calories": 52,
"serving_size": "100g",
"nutrients": {
"carbohydrates": 13.8,
"protein": 0.3,
"fat": 0.2,
"fiber": 2.4
}
},
{
"food_id": "789012",
"name": "Apple juice, unsweetened",
"brand": "Example Brand",
"calories": 46,
"serving_size": "100ml",
"nutrients": {
"carbohydrates": 11.2,
"protein": 0.1,
"fat": 0.1,
"fiber": 0.2
}
}
]
}
```
#### Add Nutrition Entry
```http
POST /api/v1/nutrition/entries
Authorization: Bearer <token>
```
**Body:**
```json
{
"food_id": "123456",
"date": "2025-10-16",
"meal_type": "lunch",
"quantity": 1.0,
"serving_size": "100g",
"notes": "Red apple"
}
```
#### Get Daily Nutrition Summary
```http
GET /api/v1/nutrition/daily-summary?date=2025-10-16
Authorization: Bearer <token>
```
**Response:**
```json
{
"date": "2025-10-16",
"total_calories": 1578,
"total_carbohydrates": 175.3,
"total_proteins": 78.2,
"total_fats": 52.8,
"total_water": 1200,
"entries": [
{
"id": 123,
"food_name": "Apple, raw, with skin",
"meal_type": "lunch",
"calories": 52,
"quantity": 1.0,
"serving_size": "100g"
}
]
}
```
#### Track Water Intake
```http
POST /api/v1/nutrition/water
Authorization: Bearer <token>
```
**Body:**
```json
{
"date": "2025-10-16",
"amount_ml": 250,
"time": "12:30:00"
}
```
### 📊 System Status
#### Check Service Health