Add flight service
This commit is contained in:
5
flight-service/.metadata.json
Normal file
5
flight-service/.metadata.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"displayName": "Задание: Flight Service",
|
||||||
|
"pubDate": "23.02.2026",
|
||||||
|
"hide": true
|
||||||
|
}
|
||||||
238
flight-service/index.md
Normal file
238
flight-service/index.md
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
# Музыкальный Сервис
|
||||||
|
|
||||||
|
## HTTP API
|
||||||
|
|
||||||
|
### Регистрация нового пользователя
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
```http title="Request"
|
||||||
|
PUT /api/users HTTP/1.1
|
||||||
|
Accept: application/json
|
||||||
|
```
|
||||||
|
|
||||||
|
```json title="Request Body Example"
|
||||||
|
{
|
||||||
|
"first_name": "Ivan",
|
||||||
|
"last_name": "Ivanov",
|
||||||
|
"age": 25
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```json title="Response Body Example"
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"first_name": "Ivan",
|
||||||
|
"last_name": "Ivanov",
|
||||||
|
"age": 25
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Получение пользователя
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
```http title="Request"
|
||||||
|
GET /api/users/{id} HTTP/1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
```json title="Response Body Example"
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"first_name": "Ivan",
|
||||||
|
"last_name": "Ivanov",
|
||||||
|
"age": 25
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Получение информации о самолете
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
```http title="Request"
|
||||||
|
POST /api/airplane/{id} HTTP/1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
```json title="Response Body Example"
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"name": "Airplane #1",
|
||||||
|
"max_passengers": 115,
|
||||||
|
"max_cargo_weight": 7350
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Список всех самолетов
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
```http title="Request"
|
||||||
|
GET /api/airplane HTTP/1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Query Parameters</summary>
|
||||||
|
|
||||||
|
| Name | Default value | Description |
|
||||||
|
|------|---------------|-------------|
|
||||||
|
| page | 0 | Страница |
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
```json title="Response Body Example"
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"name": "Airplane #1",
|
||||||
|
"max_passengers": 115,
|
||||||
|
"max_cargo_weight": 7350
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Получение информации об аэропорте
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
```http
|
||||||
|
GET /api/airport/{id} HTTP/1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
```json title="Response Body Example"
|
||||||
|
{
|
||||||
|
"id": 32,
|
||||||
|
"Name": "Airport #32",
|
||||||
|
"longitude": 47.488425,
|
||||||
|
"latitude": 39.929261
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Список всех аэропортов
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
```http title="Request"
|
||||||
|
GET /api/airport HTTP/1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Query Parameters</summary>
|
||||||
|
|
||||||
|
| Name | Default value | Description |
|
||||||
|
|------|---------------|-------------|
|
||||||
|
| page | 0 | Страница |
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
```json title="Response Body Example"
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 32,
|
||||||
|
"Name": "Airport #32",
|
||||||
|
"longitude": 47.488425,
|
||||||
|
"latitude": 39.929261
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Создание нового рейса
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
```http title="Request"
|
||||||
|
POST /api/flight HTTP/1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
```json title="Request Body Example"
|
||||||
|
{
|
||||||
|
"departure_airport": 12,
|
||||||
|
"arrival_airport": 15,
|
||||||
|
"airplane": 3,
|
||||||
|
"departure_timestamp": 1771834281934
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```json title="Response Body Example"
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"departure_airport": {
|
||||||
|
"id": 12,
|
||||||
|
"Name": "Airport #12",
|
||||||
|
"longitude": 47.488425,
|
||||||
|
"latitude": 39.929261
|
||||||
|
},
|
||||||
|
"arrival_airport": {
|
||||||
|
"id": 15,
|
||||||
|
"Name": "Airport #15",
|
||||||
|
"longitude": 47.488425,
|
||||||
|
"latitude": 39.929261
|
||||||
|
},
|
||||||
|
"airplane": {
|
||||||
|
"id": 3,
|
||||||
|
"name": "Airplane #3",
|
||||||
|
"max_passengers": 115,
|
||||||
|
"max_cargo_weight": 7350
|
||||||
|
},
|
||||||
|
"departure_timestamp": 1771834281934,
|
||||||
|
"passengers": []
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Получение информации о рейсе
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
```http title="Request"
|
||||||
|
GET /api/flight/{id} HTTP/1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
```json title="Response Body Example"
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"departure_airport": {
|
||||||
|
"id": 12,
|
||||||
|
"Name": "Airport #12",
|
||||||
|
"longitude": 47.488425,
|
||||||
|
"latitude": 39.929261
|
||||||
|
},
|
||||||
|
"arrival_airport": {
|
||||||
|
"id": 15,
|
||||||
|
"Name": "Airport #15",
|
||||||
|
"longitude": 47.488425,
|
||||||
|
"latitude": 39.929261
|
||||||
|
},
|
||||||
|
"airplane": {
|
||||||
|
"id": 3,
|
||||||
|
"name": "Airplane #3",
|
||||||
|
"max_passengers": 115,
|
||||||
|
"max_cargo_weight": 7350
|
||||||
|
},
|
||||||
|
"departure_timestamp": 1771834281934,
|
||||||
|
"passengers": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"first_name": "Ivan",
|
||||||
|
"last_name": "Ivanov",
|
||||||
|
"age": 25
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Регистрация пассажира на рейс
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
```http title="Request"
|
||||||
|
POST /api/flight/register HTTP/1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
```json title="Request Body Example"
|
||||||
|
{
|
||||||
|
"flight_id": 1,
|
||||||
|
"user_id": 3
|
||||||
|
}
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user