---
# System prepended metadata

title: Дока платформы №1

---

# Дока платформы №1 
# Общее
часть 2 : https://hackmd.io/eT_qdFlMRRW4y7tKpDPM0A
### Обработка ошибок. Формат ошибок

Пример 1
```
{
    "errors": {
        "message": "Сессия не найдена",
        "status_code": 422
    }
}
```

Пример 2
```
{
    "errors": {
        "fields": {
            "email": [
                "Поле E-Mail адрес должно быть действительным электронным адресом."
            ],
            "password": [
                "Количество символов в поле Пароль должно быть не меньше 6."
            ]
        },
        "message": "Неверный формат данных",
        "status_code": 422
    }
}
```

### Полечение конфигов Эвента. (даты, в которые проводится мероприятие)
GET /api/event/config

Пример ответа
```
{
    "data": {
        "dates": [
            "2020-09-12T00:00:00.000000Z",
            "2020-09-13T00:00:00.000000Z",
        ]
    }
}
```


### Получение локалей (языков) мероприятия (в том числе дефолтного языка)
GET /api/event/locales

```
{
    "data": [
        {
            "id": 2,
            "name": "Русский",
            "code": "ru",
            "created_at": null,
            "updated_at": null,
            "default": false
        },
        {
            "id": 1,
            "name": "English",
            "code": "en",
            "created_at": null,
            "updated_at": "2020-09-04T08:03:05.000000Z",
            "default": true
        }
    ]
}
```

# User

### Логин
POST /api/login
```
{
    "email":"i.iskhakov@truemachine.ru",
    "password":"ilnur119"
}
```
### Регистрация
POST /api/register
*ps пока для регистрации заложены только следующие поля. После выгирыша тендера придет информация о других полях.
```
{
    "email":"i.iskhakov@truemachine.ru",
    "password":"ilnur119",
    "phone":"+79278043536",
}
```

### Удаление пользователя
DELETE /api/users/{id}

### Выход из аккаунта
POST /api/logout

### Удаление аватарки
DELETE /api/users/delete-avatar

### Обновление пользователя админом (изменения типа пользователя)
PUT /api/user/{userId}

**Важно: если нужно поменять тип юзера, то нужно обязательно отправлять в этом запросе его ФИО, биографию и т.д., т.к. из-за слишком гибкой архитектуры старые данные потрутся (делать для всех локалей)**

```
{
    "user_type": "participant|speaker|null" (для null подставвится participant)
}
```


### Добавить спикера к сессиями (используется на странице с деталкой спикера)
PUT /api/users/add-to-sessions/{speakerUserId}
speakerUserId - ID спикера, которого присоединяем к сессиям
id и role - это ID сессии и role - это роль спикера в данной сессии (Speaker|Moderator)
Пример запроса
```
{
    "sessions":[
        {
            "id":1,
            "role":"Speaker"
        },
        {
            "id":2,
            "role":"Moderator"
        }
    ]
}
```

Пример ответа:
```
{
    "data": {
        "id": 1,
        "email": "admin@admin.ru",
        "created_at": "2020-08-17T14:38:29.000000Z",
        "updated_at": "2020-08-17T14:38:29.000000Z",
        "deleted_at": null,
        "phone": "899999999",
        "moderation_status": null,
        "role": [
            "administrator"
        ],
        "profile": {
            "id": 1,
            "user_id": 1,
            "deleted_at": null,
            "created_at": "2020-08-17T14:38:32.000000Z",
            "updated_at": "2020-08-17T14:38:32.000000Z",
            "first_name": "Артемий",
            "last_name": "Илья Романович Доронин",
            "middle_name": "Куликовa Витольд Фёдорович",
            "biography": "Hello, I`m Артемий",
            "full_name": "Артемий Куликовa Витольд Фёдорович Илья Романович Доронин"
        },
        "avatar": "https://event-service-backend-dev.truemachine.ru/uploads/avatars/default.jpeg",
        "type": "speaker",
        "is_favorite": false,
        "sessions": [
            {
                "id": 1,
                "title": "Филатовa Street",
                "description": "A rerum dolorum quo. Architecto alias odio sed ab corrupti nihil. Magni et nobis iste id distinctio non. Qui est consequuntur a dolorem repudiandae.",
                "start": "2020-09-02T08:20:00.000000Z",
                "end": "2020-09-02T08:35:00.000000Z",
                "track_id": 1,
                "category_id": 1,
                "chat_id": null,
                "broadcast_url": "http://erdman.net/",
                "embed_code": "79567",
                "can_ask_speaker_before": true,
                "created_at": "2020-08-17T14:38:32.000000Z",
                "updated_at": "2020-08-17T14:38:32.000000Z",
                "pivot": {
                    "user_id": 1,
                    "session_id": 1,
                    "role": "Speaker"
                },
                "is_favorite": false
            }
        ]
    }
}
```

### Cписок пользователей на модерации GET api/moderation/users
Пример ответа
```
"data": [
        {
            "id": 85,
            "email": "schuppe.jazmin@example.com",
            "created_at": "2020-08-14T11:15:02.000000Z",
            "updated_at": "2020-08-14T11:15:02.000000Z",
            "deleted_at": null,
            "phone": "1-410-518-0664 x7116",
            "moderation_status": "moderate",
            "role": [
                "users"
            ]
        },
        {
            "id": 87,
            "email": "edison.kohler@example.org",
            "created_at": "2020-08-14T11:15:03.000000Z",
            "updated_at": "2020-08-14T11:15:03.000000Z",
            "deleted_at": null,
            "phone": "(729) 878-3976",
            "moderation_status": "moderate",
            "role": [
                "users"
            ]
        }
```
### Изменить статуса пользователя PUT api/moderation/users/{id}
Тело запроса
```
{
     'status' => 'required|in:approve,reject,moderate',
    'comment' => 'required'
}
```
Пример ответа
```
{
    "data": {
        "id": 93,
        "email": "tillman.baylee@example.com",
        "created_at": "2020-08-14T11:15:03.000000Z",
        "updated_at": "2020-08-15T15:37:38.000000Z",
        "deleted_at": null,
        "phone": "1-206-415-2325 x41516",
        "moderation_status": "approve",
        "role": [
            "speaker"
        ]
    }
}
```

### Добавить пользователя в избранное api/favorite/user/{id}
Пример ответа
```
{
    "data": {
        "id": 1,
        "email": "admin@admin.ru",
        "created_at": "2020-08-14T11:30:43.000000Z",
        "updated_at": "2020-08-14T11:30:43.000000Z",
        "deleted_at": null,
        "phone": "899999999",
        "role": [
            "administrator"
        ],
        "profile": null,
        "avatar": "/uploads/avatars/default.jpeg",
        "type": null
    }
}
```

### Удалить пользователя из избранных DELETE api/favorite/user/{id}
Код ответа 204

### Логин пользователя по ключу стороннего сервиса POST api/login/key

Тело запроса
```
{
    "key": "string"
}
```

Рабочие коды: https://truemachine.atlassian.net/wiki/spaces/KDHAU/pages/83460098


Примеры ответа
1) Код пользователя верный (код ответа 200)
```
{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiI1IiwianRpIjoiMDI3Yzc5MzgxZGQzNjAwYzI0NmVmYmEyNjk5Y2I5NTY2YjY0OGQ2NzIxNTM2MmQxYWE0MjM1ZWFkMzFkODE3YjJjYjY5NmY3OTczNjliMjAiLCJpYXQiOjE1OTkyMDYzNDAsIm5iZiI6MTU5OTIwNjM0MCwiZXhwIjoxNjMwNzQyMzQwLCJzdWIiOiI5NDgxIiwic2NvcGVzIjpbXX0.YHqGa3OluWfIX-OoKVy-t2Ueo6WLnD7V_Yh1QC32c5okEAwSmIC-O_aHklbPwSEaEgkelgIJpmkmThIZGdTHgXWEYr9ewyydPPiYcA63fRsBYp0zwsUWU9AKMIyCSRRVR1Me8MKXHSltRJDTP9PSeuj1Pmp9hnL3sqhHTPX_jPRBnQtuknRrMCVLIGT9HBdr_3uaKL2daw8O_QnPqAIFpvewXnmME-sMAB_3m6Q1dPG-hPqkuzpPaxAwRvNtEqK7TaDLLPpuvV4bv9DEID0pWT4DGC3jxflwjWgJrtv3Wit8A0AMjlbnvL9MdeUQM0E6Z3MDW2ZwV46zoF7bo5XsfjaDq7My-YId3G3e_Dpc1ZVjDB7uHMQAjqXxq-E_dryMVBTcpYMC6xFy6xaauh22W7Bf_i6YhBQCTQhXKtkhkxJrOxCPEY_Met1_JrTEjs50KpPk0Sc0SEjJ0gzbq108znvlshieL5YlAXHwrHAhhK10gzBOW9xGJi7YJS3K9_ExfC28UPaR-6akMUyzy1XlaIpiJur-MHpH4SuNX-oN0Vr6LGQ5pX-IqjkaOVTiAu7p2l3l1HMKOPJ5_iQU7NrYZIuRHyxCg_c786K6_lMyFkawXXNCq7HJeDu1NOyAti-oY3d9K2O6qoqc86DpZzRB6dmEYyJbUZzIARHH0qAna3c",
    "email": "amway email 0_2020-09-03 10:39:05",
    "user": {
        "id": 9481,
        "email": "email 0_2020-09-03 10:39:05",
        "created_at": "2020-09-03T10:39:05.000000Z",
        "updated_at": "2020-09-03T10:39:05.000000Z",
        "deleted_at": null,
        "phone": "amway phone",
        "moderation_status": "approve",
        "key": "727730711904731",
        "role": [
            "user"
        ],
        "profile": {
            "id": 9358,
            "user_id": 9481,
            "first_name": "Илья",
            "last_name": "Евлахов",
            "middle_name": null,
            "full_name": null,
            "company": null,
            "goals": null,
            "interests": null,
            "biography": null
        },
        "avatar": "/uploads/previews/avatar-preview.jpeg",
        "type": "participant",
        "is_favorite": false,
        "frontend_role" : "adminsitrator|support|parent|children"
    }
}
```
2) Код пользователя неверный (код ответа 400)
```
{
    "errors": {
        "fields": {
            "key": [
                "Неверный код доступа"
            ]
        },
        "message": "Неверный формат данных",
        "status_code": 422
    }
}
```
3) Номер пользователя неверный (код ответа 400)
```
{
    "errors": {
        "fields": {
            "key": [
                "Неверный номер телефона"
            ]
        },
        "message": "Неверный формат данных",
        "status_code": 422
    }
}
```
### Коды логинившихся amway-пользователей GET /api/users/logged
Ответ
```
[
    "464554906793825",
    "933263411066022",
    "691766536197148",
    "659941921739029"
]
```
### Список всех пользователей GET /api/users?locale=ru
[Рекомендуется к просмотру](https://truemachine.slack.com/files/UFNFNHR4Z/F01BQF0E5FW/2020-09-28_19-54-12.mp4)
Параметры фильтрации (получаются через [словари](https://hackmd.io/_kgd71kBS02cA5JH1DGVTw?view#%D0%9F%D0%BE%D0%BB%D1%83%D1%87%D0%B5%D0%BD%D0%B8%D0%B5-%D1%84%D0%B8%D0%BB%D1%8C%D1%82%D1%80%D0%BE%D0%B2-%D0%B4%D0%BB%D1%8F-%D0%B0%D0%B4%D0%BC%D0%B8%D0%BD%D0%B0-GET-apiuser-filterslocaleru)):
1) type - тип поля, по которому производится фильтрация;
2) field - поле, по которому производится фильтрация;
3) conditions - условия фильтрации;
4) value - значения фильтрации.

GET-параметр filter
```

filter={"attributes": [
        {
            "type": bigint|integer|string|datetime|enum|boolean,
            "field": id|email|created_at|updated_at|phone|moderation_status|blocked|role|type|full_name|country_id|city_id|last_online|blocked_date|online,
            "conditions": type_conditions,
            "value": type_values
        }   
    ]
}
```
Условия и значения для каждого типа
```
1) bigint|integer:
   value = number|array
   conditions = filled|not_filled|equal|not_equal|like|not_like|more|less|interval
   value = array - только для inteval
2) string:
    value = string
    conditions = filled|not_filled|equal|not_equal|like|not_like
3) datetime:
    value = yyyy-mm-dd|null|number|time_array
    conditions = any|yesterday|today|period|time_interval
    value = null - только для yesterday и today
    value = number - только для period
    value = time_array - только для time_interval
4) boolean
    value = true|false
    conditions = null
5) enum
    value = null
    conditions = enum_condition|array|all
    для каждого поля enum свои enum_condition, которые можно получить в словарях
    
    all - "all"
    null - null|""
    array - ["value1", "value2", ...]
    time_array - ["begin", "end"]
```
[Примечания](https://translate.google.ru/?hl=en&tab=TT&authuser=0)
```
filled - заполнено
not_filled - не заполнено
equal - равно
not_equal - не равно
like - включает
not_like - не включает
more - больше
less - меньше
interval - промежуток
any - любая дата
yesterday - вчера
today - сегодня
period - период дней
time_interval - диапазон дней
```
Пример запроса
```
/api/users?locale=ru&filter={"attributes": [{"type": "datetime", "field": "created_at","conditions": "time_interval","value": ["2020-09-09", "2020-09-29"]}, {"type": "boolean", "field": "online","conditions": "","value": false}]}
```
Ответ
```
{
    "data": [
        {
            "id": 3,
            "email": "test2@mail.ru",
            "phone": "+7-927-341-12-11",
            "type": "speaker",
            "role": [
                "user"
            ],
            "profile": {
                "id": 2,
                "user_id": 3,
                "deleted_at": null,
                "created_at": "2020-09-09T07:32:05.000000Z",
                "updated_at": "2020-09-09T07:32:05.000000Z",
                "first_name": "Иван2",
                "last_name": "Иванов2",
                "middle_name": "Иванович",
                "biography": "Привет! Я фронтенд разработчик в Компании 2",
                "full_name": "Иван2 Иванов2 Иванович"
            },
            "country": null,
            "city": null,
            "avatar": "https://event-service-backend-dev.truemachine.ru/uploads/previews/avatar-preview.jpeg",
            "moderation_status": "moderate",
            "is_favorite": true
        }
    ],
    "links": {
        "first": "https://event-service-backend-dev.truemachine.ru/api/users?page=1",
        "last": "https://event-service-backend-dev.truemachine.ru/api/users?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://event-service-backend-dev.truemachine.ru/api/users",
        "per_page": "100",
        "to": 1,
        "total": 1
    }
}
```
### Блокировка пользователя POST /api/users/{id}/block
Ответ
```
{
    "success": "ok"
}
```
### Разблокировка пользователя POST /api/users/{id}/un-block
Ответ
```
{
    "success": "ok"
}
```
### Получение фильтров для админа GET /api/user-filters?locale=ru
1) field - поле, по которому производится фильтрация;
2) field_label - метка поля для селектбокса;
3) type - тип поля, по которому производится фильтрация;
4) conditions - условия фильтрации;
5) conditions_labels - метки условий фильтрации для селектбокса
6) value - значения фильтрации.
Ответ
```
[
    {
        "field": "id",
        "field_label": "ID",
        "type": "bigint",
        "conditions": [
            "filled",
            "not_filled",
            "equal",
            "not_equal",
            "like",
            "not_like",
            "more",
            "less",
            "interval"
        ],
        "conditions_labels": {
            "filled": "Заполнено",
            "not_filled": "Не заполнено",
            "equal": "Равно",
            "not_equal": "Не равно",
            "like": "Включает",
            "not_like": "Не включает",
            "more": "Больше",
            "less": "Меньше",
            "interval": "Промежуток"
        }
    },
    {
        "field": "email",
        "field_label": "Фильтр по email",
        "type": "string",
        "conditions": [
            "filled",
            "not_filled",
            "equal",
            "not_equal",
            "like",
            "not_like"
        ],
        "conditions_labels": {
            "filled": "Заполнено",
            "not_filled": "Не заполнено",
            "equal": "Равно",
            "not_equal": "Не равно",
            "like": "Включает",
            "not_like": "Не включает"
        }
    },
    {
        "field": "created_at",
        "field_label": "По дате регистрации",
        "type": "datetime",
        "conditions": [
            "any",
            "yesterday",
            "today",
            "period",
            "time_interval"
        ],
        "conditions_labels": {
            "any": "Любая дата",
            "yesterday": "Вчера",
            "today": "Сегодня",
            "period": "Период в N дней",
            "time_interval": "Диапозон"
        }
    },
    {
        "field": "updated_at",
        "field_label": "По дате обновления",
        "type": "datetime",
        "conditions": [
            "any",
            "yesterday",
            "today",
            "period",
            "time_interval"
        ],
        "conditions_labels": {
            "any": "Любая дата",
            "yesterday": "Вчера",
            "today": "Сегодня",
            "period": "Период в N дней",
            "time_interval": "Диапозон"
        }
    },
    {
        "field": "phone",
        "field_label": "Фильтр по телефону",
        "type": "string",
        "conditions": [
            "filled",
            "not_filled",
            "equal",
            "not_equal",
            "like",
            "not_like"
        ],
        "conditions_labels": {
            "filled": "Заполнено",
            "not_filled": "Не заполнено",
            "equal": "Равно",
            "not_equal": "Не равно",
            "like": "Включает",
            "not_like": "Не включает"
        }
    },
    {
        "field": "moderation_status",
        "field_label": "По статусу модерации",
        "type": "enum",
        "conditions": [
            "approve",
            "moderate",
            "reject"
        ],
        "conditions_labels": {
            "approve": "Подвтержден",
            "moderate": "Модерация",
            "reject": "Отклонен"
        }
    },
    {
        "field": "blocked",
        "field_label": "Заблокирован",
        "type": "boolean",
        "conditions": [
            "true",
            "false"
        ],
        "conditions_labels": {
            "true": "Да",
            "false": "Нет"
        }
    },
    {
        "field": "role",
        "field_label": "Фильтр по ролям",
        "type": "enum",
        "conditions": [
            "administrator",
            "user"
        ],
        "conditions_labels": {
            "administrator": "Администратор",
            "user": "Пользователь"
        }
    },
    {
        "field": "type",
        "field_label": "Фильтр по типам",
        "type": "enum",
        "conditions": [
            "participant",
            "speaker"
        ],
        "conditions_labels": {
            "participant": "Участник",
            "speaker": "Спикер"
        }
    },
    {
        "field": "full_name",
        "field_label": "Фильтр по ФИО",
        "type": "string",
        "conditions": [
            "filled",
            "not_filled",
            "equal",
            "not_equal",
            "like",
            "not_like"
        ],
        "conditions_labels": {
            "filled": "Заполнено",
            "not_filled": "Не заполнено",
            "equal": "Равно",
            "not_equal": "Не равно",
            "like": "Включает",
            "not_like": "Не включает"
        }
    },
    {
        "field": "country_id",
        "field_label": "Фильтр по стране",
        "type": "enum",
        "conditions_labels": [
            "Австрия": 1,
            "Албания": 2,
            "Андорра": 3,
            "Беларусь": 4,
            "Бельгия": 5,
            ...
        ]
    },
    {
        "field": "city_id",
        "field_label": "Фильтр по городу",
        "type": "enum",
        "conditions_labels": [
            "Барнаул": 1,
            "Бийск": 2,
            "Благовещенск": 3,
            "Архангельск": 4,
            "Вельск": 5,
            ...
        ]
    },
     {
        "field": "last_online_date",
        "field_label": "По дате последнего захода",
        "type": "datetime",
        "conditions": [
            "any",
            "yesterday",
            "today",
            "period",
            "time_interval"
        ],
        "conditions_labels": {
            "any": "Любая дата",
            "yesterday": "Вчера",
            "today": "Сегодня",
            "period": "Период в N дней",
            "time_interval": "Диапозон"
        }
    },
    {
        "field": "blocked_date",
        "field_label": "По дате блокировки",
        "type": "datetime",
        "conditions": [
            "any",
            "yesterday",
            "today",
            "period",
            "time_interval"
        ],
        "conditions_labels": {
            "any": "Любая дата",
            "yesterday": "Вчера",
            "today": "Сегодня",
            "period": "Период в N дней",
            "time_interval": "Диапозон"
        }
    },
    {
        "field": "online",
        "field_label": "По online",
        "type": "boolean",
        "conditions": [
            "true",
            "false"
        ],
        "conditions_labels": {
            "true": "Да",
            "false": "Нет"
        }
    }
]
```
### Получение списка ролей GET /api/user-roles
название: id
```
{
    "administrator": 1,
    "user": 2,
    "guest": 3
}
```
### Логин пользователей GoldAmway POST /api/login/amway
```
{
    "key":"string"
}
```
### Список пользователей из редиса GET /api/users/search
```
{
    name=string - параметр для поиска
}
```
```
{
    "data": [
        {
            "id": "1426",
            "first_name": "Екатерина",
            "last_name": "Вожегова",
            "chat_status": "active"
        },
        {
            "id": "2026",
            "first_name": "Екатерина",
            "last_name": "Вознесенская",
            "chat_status": "active"
        },
        {
            "id": "902",
            "first_name": "Лидия",
            "last_name": "Волгарева",
            "chat_status": "active"
        },
        {
            "id": "1210",
            "first_name": "Алексей",
            "last_name": "Волков",
            "chat_status": "active"
        },
        {
            "id": "2288",
            "first_name": "Инна",
            "last_name": "Волкова",
            "chat_status": "active"
        },
        {
            "id": "860",
            "first_name": "Елена",
            "last_name": "Волкова",
            "chat_status": "active"
        },
        {
            "id": "1192",
            "first_name": "Татьяна",
            "last_name": "Воловик",
            "chat_status": "active"
        },
        {
            "id": "440",
            "first_name": "Елена",
            "last_name": "Волохова",
            "chat_status": "active"
        },
        {
            "id": "194",
            "first_name": "Максим",
            "last_name": "Воробьев",
            "chat_status": "active"
        },
        {
            "id": "1378",
            "first_name": "Ольга",
            "last_name": "Воробьева",
            "chat_status": "active"
        },
        {
            "id": "1798",
            "first_name": "Елена",
            "last_name": "Воробьева",
            "chat_status": "active"
        },
        {
            "id": "2042",
            "first_name": "Юрий",
            "last_name": "Воронин",
            "chat_status": "active"
        },
        {
            "id": "2266",
            "first_name": "Юлия",
            "last_name": "Воронкова",
            "chat_status": "active"
        },
        {
            "id": "2142",
            "first_name": "Дмитрий",
            "last_name": "Ворошилов",
            "chat_status": "active"
        },
        {
            "id": "238",
            "first_name": "Татьяна",
            "last_name": "Вострецова",
            "chat_status": "active"
        },
        {
            "id": "2018",
            "first_name": "Ольга",
            "last_name": "Вострикова",
            "chat_status": "active"
        },
        {
            "id": "2268",
            "first_name": "Евгения",
            "last_name": "Вотинцева",
            "chat_status": "active"
        },
        {
            "id": "798",
            "first_name": "Наталья",
            "last_name": "Вохмина",
            "chat_status": "active"
        },
        {
            "id": "1078",
            "first_name": "Денис",
            "last_name": "Воякин",
            "chat_status": "active"
        },
        {
            "id": "1368",
            "first_name": "Роман",
            "last_name": "Вшивков",
            "chat_status": "active"
        }
    ],
    "meata": {
        "per_page": 20,
        "current_page": 11,
        "last_page": 60,
        "total": 1198
    }
}
```
# Category (Категория)
*Важное примечение*. При создании и обновлении записи указывается locale. И в таблицах с транслитеряцией создается/обновляется тот locale, который был указан в GET параметре locale. Чтобы создать сущность сразу с заполненными 2-умя, 3-емя и тд locale - нужно сначала создать запись с одним locale, и для остальных locale поочередно вызывать метод обновления категории.
### Создание категории. POST /api/categories?locale={en / ru}
Код ответа - 201
Тело запроса 
```
{
    "name":"Моя категория 2"
}
```
Пример ответа
```
{
    "data": {
        "id": 26,
        "created_at": "2020-08-12T07:41:14.000000Z",
        "updated_at": "2020-08-12T07:41:14.000000Z",
        "deleted_at": null,
        "name": "Моя категория 2"
    }
}
```
### Обновление категории. PUT /api/categories/{id}?locale={en / ru}
Код ответа - 202
Тело запроса 
```
{
    "name":"Моя категория 2"
}
```
Пример ответа
```
{
    "data": {
        "id": 26,
        "created_at": "2020-08-12T07:41:14.000000Z",
        "updated_at": "2020-08-12T07:41:14.000000Z",
        "deleted_at": null,
        "name": "Моя категория 2"
    }
}
```
### Список категорий. GET /api/categories?locale={en / ru}
Код ответа - 200
### query params 
```
{
   name,
   category_id,
   sort[name] = id/created_at/locale_id/name
   sort[direction] = asc/desc
}
```
Пример ответа
```
{
    "data": [
        {
            "id": 1,
            "created_at": "2020-08-12T08:01:16.000000Z",
            "updated_at": "2020-08-12T08:01:16.000000Z",
            "deleted_at": null,
            "name": "HoneyDew"
        },
        {
            "id": 2,
            "created_at": "2020-08-12T08:01:16.000000Z",
            "updated_at": "2020-08-12T08:01:16.000000Z",
            "deleted_at": null,
            "name": "Purple"
        },
    ],
    "links": {
        "first": "http://localhost:8046/api/categories?page=1",
        "last": "http://localhost:8046/api/categories?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "http://localhost:8046/api/categories",
        "per_page": 15000,
        "to": 20,
        "total": 20
    }
}
```
### Категория. GET /api/categories/{id}?locale={en / ru}
Код ответа - 200
Пример ответа
```
{
    "data": {
        "id": 1,
        "created_at": "2020-08-12T08:01:16.000000Z",
        "updated_at": "2020-08-12T08:01:16.000000Z",
        "deleted_at": null,
        "name": "HoneyDew"
    }
}
```
### Удаление категории. DELETE /api/categories/{id}?locale={en / ru}
Код ответа - 204


# Flow (Потоки)
Тоже самое, что и у модели Category, только изменяется путь на /api/flows
у сущности flow есть тоже только поле name
### query params GET /api/flows
```
{
   name,
   flow_id,
   sort[name] = id/created_at/locale_id/name
   sort[direction] = asc/desc
}
```

# Session (Сессии)
### query params GET /api/sessions
```
{
   embed_code,
   can_ask,
   flow_id,
   time_interval = begin_date, end_date - пример "time_interval=2020-09-09 05:00, 2020-09-10 10:00",
   broadcast_url,
   begin_date - пример (2020-10-10),
   name,
   description,
   session_id,
   session_mark,
   sort[name] = id/category_id/flow_id/begin_date/end_date/embed_code/can_ask/created_at/name/description
   sort[direction] = asc/desc
   search,
   speakers =1,2,... - пример "speakers=1,2",
   is_live = true|false,
   is_favorite = true|false,
   date_range = begin_date,end_date - пример "date_range=2020-09-09 05:00,2020-09-10 10:00"
}
```

### Получить все сессии (без привязки к категории)
GET /api/sessions/all

Пример ответа:
```
{
    "data": [
        {
            "id": 1,
            "title": "Rau Valleys",
            "description": "Qui fuga enim rerum delectus qui. A atque quia ad quas. Earum nulla provident veritatis et.",
            "start": "2020-09-02T08:20:00.000000Z",
            "end": "2020-09-02T08:35:00.000000Z",
            "track_id": 1,
            "category_id": 1,
            "chat_id": null,
            "broadcast_url": "http://erdman.net/",
            "embed_code": "79567",
            "can_ask_speaker_before": true,
            "created_at": "2020-08-17T14:38:32.000000Z",
            "updated_at": "2020-08-17T14:38:32.000000Z",
            "is_favorite": false
        },
        {
            "id": 2,
            "title": "Nat Square",
            "description": "Minima est deleniti maiores aut maiores et iure sint. Odio voluptas vero dolorum voluptatibus.",
            "start": "2020-09-02T08:55:00.000000Z",
            "end": "2020-09-02T09:55:00.000000Z",
            "track_id": 1,
            "category_id": 1,
            "chat_id": null,
            "broadcast_url": "http://www.predovic.com/ratione-saepe-sint-qui-modi.html",
            "embed_code": "14437-9948",
            "can_ask_speaker_before": false,
            "created_at": "2020-08-17T14:38:32.000000Z",
            "updated_at": "2020-08-17T14:38:32.000000Z",
            "is_favorite": true
        },
        {
            "id": 3,
            "title": "Jenkins Mills",
            "description": "Voluptatem nostrum voluptas est. Omnis similique aliquid et odit. Ut soluta blanditiis ea dicta aut expedita at. Magnam consectetur sit magnam rem odit velit.",
            "start": "2020-09-02T11:05:00.000000Z",
            "end": "2020-09-02T11:35:00.000000Z",
            "track_id": null,
            "category_id": 1,
            "chat_id": null,
            "broadcast_url": "http://www.ernser.info/nostrum-autem-nostrum-porro.html",
            "embed_code": "61840-4785",
            "can_ask_speaker_before": false,
            "created_at": "2020-08-17T14:38:32.000000Z",
            "updated_at": "2020-08-17T14:38:32.000000Z",
            "is_favorite": true
        }
    ],
    "links": {
        "first": "http://localhost:8046/api/sessions/all?page=1",
        "last": "http://localhost:8046/api/sessions/all?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "http://localhost:8046/api/sessions/all",
        "per_page": 15000,
        "to": 1070,
        "total": 1070
    }
```

### Создание сессии POST /api/sessions
Тело запроса
```
{
    "begin_date":"2020-09-20 19:00:00",
    "end_date":"2020-09-20 19:30:00",
    "name":"Test",
    "description":"ajndsjui",
    "broadcast_url":"https://test.ru",
    "embed_code":"asdfj",
    "can_ask_speaker_before":true,
    "category_id":1,
    "flow_id":1,
    "chat_before_live": "true",
    "questions_before_live": "true",
    "player_before_live": "true",
    "speakers":[
        {
            "id":1,
            "role":"Speaker"
        },
        {
            "id":2,
            "role":"Moderator"
        }
    ]
}
```

Пример ответа
```
{
    "data": {
        "begin_date": "2020-09-20T19:00:00.000000Z",
        "end_date": "2020-09-20T19:30:00.000000Z",
        "broadcast_url": "https://test.ru",
        "embed_code": "asdfj",
        "can_ask_speaker_before": true,
        "category_id": 1,
        "flow_id": 1,
        "chat_before_live": "true",
        "questions_before_live": "true",
        "player_before_live": "true",
        "updated_at": "2020-08-18T12:11:56.000000Z",
        "created_at": "2020-08-18T12:11:56.000000Z",
        "id": 1070,
        "chat_id": "1",
        "name": "Test",
        "description": "ajndsjui",
        "is_favorite": false,
        "speakers": [
            {
                "id": 1,
                "email": "admin@admin.ru",
                "created_at": "2020-08-17T14:38:29.000000Z",
                "updated_at": "2020-08-17T14:38:29.000000Z",
                "deleted_at": null,
                "phone": "899999999",
                "moderation_status": null,
                "role": [
                    "administrator"
                ],
                "pivot": {
                    "session_id": 1070,
                    "user_id": 1,
                    "role": "Speaker"
                },
                "profile": {
                    "id": 1,
                    "user_id": 1,
                    "deleted_at": null,
                    "created_at": "2020-08-17T14:38:32.000000Z",
                    "updated_at": "2020-08-17T14:38:32.000000Z",
                    "first_name": "Seth",
                    "last_name": "Prof. Harold Gutkowski",
                    "middle_name": "Prof. Kellen Willms DDS",
                    "biography": "Hello, I`m Seth",
                    "full_name": "Seth Prof. Kellen Willms DDS Prof. Harold Gutkowski"
                },
                "avatar": "https://event-service-backend-dev.truemachine.ru/uploads/avatars/default.jpeg",
                "type": "speaker",
                "is_favorite": false
            },
            {
                "id": 2,
                "email": "gaetano02@example.com",
                "created_at": "2020-08-17T14:38:31.000000Z",
                "updated_at": "2020-08-17T14:38:31.000000Z",
                "deleted_at": null,
                "phone": "1-474-977-7000 x02895",
                "moderation_status": null,
                "role": [
                    "user"
                ],
                "pivot": {
                    "session_id": 1070,
                    "user_id": 2,
                    "role": "Moderator"
                },
                "profile": {
                    "id": 2,
                    "user_id": 2,
                    "deleted_at": null,
                    "created_at": "2020-08-17T14:38:32.000000Z",
                    "updated_at": "2020-08-17T14:38:32.000000Z",
                    "first_name": "Micaela",
                    "last_name": "Mrs. Jacky Smith",
                    "middle_name": "Britney Hickle DDS",
                    "biography": "Hello, I`m Micaela",
                    "full_name": "Micaela Britney Hickle DDS Mrs. Jacky Smith"
                },
                "avatar": "https://event-service-backend-dev.truemachine.ru/uploads/avatars/default.jpeg",
                "type": "speaker",
                "is_favorite": true
            }
        ]
    }
}
```

### Изменение сессии PUT /api/sessions/{id}
Тело запроса
```
{
    "begin_date":"2020-09-20 19:00:00",
    "end_date":"2020-09-20 19:30:00",
    "name":"Test3",
    "description":"asfdsdf",
    "broadcast_url":"https://test.ru",
    "embed_code":"asdfj",
    "can_ask_speaker_before":true,
    "category_id":1,
    "flow_id":1,
    "chat_before_live": "false",
    "questions_before_live": "false",
    "player_before_live": "false",
    "speakers":[
        {
            "id": 3,
            "role":"Moderator"
        }
    ]
}
```

Пример ответа
```
{
    "data": {
        "id": 1069,
        "category_id": 1,
        "flow_id": 1,
        "begin_date": "2020-09-20T19:00:00.000000Z",
        "end_date": "2020-09-20T19:30:00.000000Z",
        "broadcast_url": "https://test.ru",
        "embed_code": "asdfj",
        "can_ask_speaker_before": true,
        "deleted_at": null,
        "created_at": "2020-08-18T10:17:00.000000Z",
        "updated_at": "2020-08-18T10:17:00.000000Z",
        "chat_id": null,
        "chat_before_live": "false",
        "questions_before_live": "false",
        "player_before_live": "false",
        "name": "Test3",
        "description": "asfdsdf",
        "is_favorite": false,
        "speakers": [
            {
                "id": 3,
                "email": "katlyn.krajcik@example.org",
                "created_at": "2020-08-17T14:38:31.000000Z",
                "updated_at": "2020-08-17T14:38:31.000000Z",
                "deleted_at": null,
                "phone": "+1-523-594-9269",
                "moderation_status": null,
                "role": [
                    "user"
                ],
                "pivot": {
                    "session_id": 1069,
                    "user_id": 3,
                    "role": "Moderator"
                },
                "profile": {
                    "id": 3,
                    "user_id": 3,
                    "deleted_at": null,
                    "created_at": "2020-08-17T14:38:32.000000Z",
                    "updated_at": "2020-08-17T14:38:32.000000Z",
                    "first_name": "Алина",
                    "last_name": "Анна Алексеевна Брагина",
                    "middle_name": "Масловaа Валентина Дмитриевна",
                    "biography": "Hello, I`m Алина",
                    "full_name": "Алина Масловaа Валентина Дмитриевна Анна Алексеевна Брагина"
                },
                "avatar": "https://event-service-backend-dev.truemachine.ru/uploads/avatars/default.jpeg",
                "type": "speaker",
                "is_favorite": true
            }
        ]
    }
}
```


### Сессия GET /api/sessions/{id}
Пример ответа
```
{
    "data": {
        "id": 2,
        "category_id": 1,
        "flow_id": 1,
        "begin_date": "2020-09-12T09:05:00.000000Z",
        "end_date": "2020-09-12T09:50:00.000000Z",
        "broadcast_url": "https://mraz.com/corporis-error-commodi-debitis-laboriosam-non-natus-similique.html",
        "embed_code": "04763",
        "can_ask_speaker_before": false,
        "deleted_at": null,
        "created_at": "2020-09-09T07:32:08.000000Z",
        "updated_at": "2020-09-09T07:32:08.000000Z",
        "chat_id": 2592,
        "is_live": true,
        "chat_before_live": false,
        "questions_before_live": false,
        "player_before_live": false,
        "name": "Braeden Way",
        "description": "Nemo quae accusantium inventore enim eligendi error dolores. Rerum est iusto deserunt adipisci praesentium. Tempora quis sequi amet veniam quo. Beatae possimus tenetur voluptatem quo corporis.",
        "speakers": [
            {
                "id": 26,
                "email": "test25@mail.ru",
                "created_at": "2020-09-09T07:32:07.000000Z",
                "updated_at": "2020-09-09T07:32:07.000000Z",
                "deleted_at": null,
                "phone": "+7-927-341-12-34",
                "moderation_status": "moderate",
                "blocked": false,
                "city_id": null,
                "country_id": null,
                "role": [
                    "user"
                ],
                "pivot": {
                    "session_id": 2,
                    "user_id": 26,
                    "role": "role_b"
                },
                "profile": {
                    "id": 25,
                    "user_id": 26,
                    "deleted_at": null,
                    "created_at": "2020-09-09T07:32:07.000000Z",
                    "updated_at": "2020-09-09T07:32:07.000000Z",
                    "first_name": "Peter",
                    "last_name": "Petrov25",
                    "middle_name": "Petrovich",
                    "biography": "Hello, I am marketing specialist  of Company 25",
                    "full_name": "Peter Petrov25"
                },
                "avatar": "https://event-service-backend-dev.truemachine.ru/uploads/previews/avatar-preview.jpeg",
                "type": "speaker",
                "is_favorite": false,
                "city": null,
                "country": null
            },
            {
                "id": 31,
                "email": "test30@mail.ru",
                "created_at": "2020-09-09T07:32:07.000000Z",
                "updated_at": "2020-09-09T07:32:07.000000Z",
                "deleted_at": null,
                "phone": "+7-927-341-12-39",
                "moderation_status": "approve",
                "blocked": false,
                "city_id": null,
                "country_id": null,
                "role": [
                    "user"
                ],
                "pivot": {
                    "session_id": 2,
                    "user_id": 31,
                    "role": "role_a"
                },
                "profile": {
                    "id": 30,
                    "user_id": 31,
                    "deleted_at": null,
                    "created_at": "2020-09-09T07:32:07.000000Z",
                    "updated_at": "2020-09-09T07:32:07.000000Z",
                    "first_name": "Peter",
                    "last_name": "Petrov30",
                    "middle_name": "Petrovich",
                    "biography": "Hello, I am marketing specialist  of Company 30",
                    "full_name": "Peter Petrov30"
                },
                "avatar": "https://event-service-backend-dev.truemachine.ru/uploads/previews/avatar-preview.jpeg",
                "type": "speaker",
                "is_favorite": false,
                "city": null,
                "country": null
            }
        ],
        "is_favorite": true,
        "track_name": "Technology",
        "marked_type": null,
        "likes": 0,
        "dislikes": 0,
        "files": [
            {
                "id": 3,
                "session_id": 2,
                "type": "image/jpeg",
                "name": "1wejiH6PyI8.jpg",
                "src": "https://event-service-backend-dev.truemachine.ru/storage/files/7TyWlfuzd3HVqgJ4aKly7NwZKKHDdvNyTEquA593.jpeg"
            }
        ]
    }
} 
```
### Добавить файл к сессии POST api/sessions/file
Тело запроса
```
{
    "session_id": required|integer,
    "file": required|array,
    "roles": required|array,
}
```
Пример ответа
```
{
    "data": [
         {
            "id": 24,
            "session_id": 2,
            "type": "image/jpeg",
            "name": "CkaEM72205o.jpg",
            "src": "https://event-service-backend-dev.truemachine.ru/storage/files/SYQcuPaIM4Tmof26H29CfXGk5sOY8YXFuzbEn65c.jpeg",
            "roles": [
                1
            ]
        },
        {
            "id": 25,
            "session_id": 2,
            "type": "image/jpeg",
            "name": "gGIcRvhL0qs.jpg",
            "src": "https://event-service-backend-dev.truemachine.ru/storage/files/em9f7Tk7J9jYMEmLKAA77GBCVz1MwgBJrJyjfSyy.jpeg",
            "roles": [
                1,
                2
            ]
        }
    ]
}
```
### Изменить доступ к файлам сессии POST api/sessions/update-permission
Тело запроса
```
{
    "files": [
        {
            "id": file_id,
            "roles": array
        }
    ]    
}
```
Пример, roles = [] - доступ для всех ролей
```
{
    "files": [
        {
            "id": 49,
            "roles": []
        },
        {
            "id": 50,
            "roles": [1, 2]
        }
    ]
}
```
### Удалить файл сессии DELETE api/sessions/file/{fileId}
Пример ответа
```
{
    "data": {
        "id": 4,
        "session_id": 2,
        "type": "image/jpeg",
        "name": "Tgmgob4DQQk.jpg",
        "src": "https://event-service-backend-dev.truemachine.ru/storage/files/BHwzpuTnz5zN2nVaVh9MY317USQanAQ8UY22tQ6J.jpeg"
    }
}
```
### Добавить сессию в избранное GET api/favorite/session/{id}
Пример ответа
```
{
    "data": {
        "id": 1,
        "category_id": 1,
        "flow_id": 1,
        "begin_date": "2020-09-02T08:33:00.000000Z",
        "end_date": "2020-09-02T09:03:00.000000Z",
        "broadcast_url": "http://schuppe.com/",
        "embed_code": "19975-5118",
        "can_ask_speaker_before": true,
        "deleted_at": null,
        "created_at": "2020-08-14T11:31:03.000000Z",
        "updated_at": "2020-08-14T11:31:03.000000Z",
        "name": "Mraz Stravenue",
        "description": "Reiciendis maxime recusandae exercitationem. Ipsam odio adipisci nisi illo. Laudantium et sint repellat odio quis eum. Eos fugiat reiciendis et est doloremque quia."
    }
}
```

### Удалить сессию из избранных DELETE api/favorite/session/{id}
Код ответа 204

### Список сессии в реальном времени GET /api/session-lives
Пример ответа
```
{
    "data": [
        {
            "id": 2,
            "title": "Braeden Way",
            "description": "Nemo quae accusantium inventore enim eligendi error dolores. Rerum est iusto deserunt adipisci praesentium. Tempora quis sequi amet veniam quo. Beatae possimus tenetur voluptatem quo corporis.",
            "start": "2020-09-12T09:05:00.000000Z",
            "end": "2020-09-12T09:50:00.000000Z",
            "track_id": 1,
            "category_id": 1,
            "chat_id": 2592,
            "broadcast_url": "https://mraz.com/corporis-error-commodi-debitis-laboriosam-non-natus-similique.html",
            "embed_code": "04763",
            "can_ask_speaker_before": false,
            "created_at": "2020-09-09T07:32:08.000000Z",
            "updated_at": "2020-09-09T07:32:08.000000Z",
            "speakers": [
                {
                    "id": 26,
                    "email": "test25@mail.ru",
                    "created_at": "2020-09-09T07:32:07.000000Z",
                    "updated_at": "2020-09-09T07:32:07.000000Z",
                    "deleted_at": null,
                    "phone": "+7-927-341-12-34",
                    "moderation_status": "moderate",
                    "blocked": false,
                    "city_id": null,
                    "country_id": null,
                    "online": false,
                    "last_online": null,
                    "role": [
                        "user"
                    ],
                    "pivot": {
                        "session_id": 2,
                        "user_id": 26,
                        "role": "role_b"
                    },
                    "profile": {
                        "id": 25,
                        "user_id": 26,
                        "deleted_at": null,
                        "created_at": "2020-09-09T07:32:07.000000Z",
                        "updated_at": "2020-09-09T07:32:07.000000Z",
                        "first_name": "Peter",
                        "last_name": "Petrov25",
                        "middle_name": "Petrovich",
                        "biography": "Hello, I am marketing specialist  of Company 25",
                        "full_name": "Peter Petrov25"
                    },
                    "avatar": "https://event-service-backend-dev.truemachine.ru/uploads/previews/avatar-preview.jpeg",
                    "type": "speaker",
                    "is_favorite": false,
                    "city": null,
                    "country": null,
                    "chat_status": "active"
                },
                {
                    "id": 31,
                    "email": "test30@mail.ru",
                    "created_at": "2020-09-09T07:32:07.000000Z",
                    "updated_at": "2020-09-09T07:32:07.000000Z",
                    "deleted_at": null,
                    "phone": "+7-927-341-12-39",
                    "moderation_status": "approve",
                    "blocked": false,
                    "city_id": null,
                    "country_id": null,
                    "online": false,
                    "last_online": null,
                    "role": [
                        "user"
                    ],
                    "pivot": {
                        "session_id": 2,
                        "user_id": 31,
                        "role": "role_a"
                    },
                    "profile": {
                        "id": 30,
                        "user_id": 31,
                        "deleted_at": null,
                        "created_at": "2020-09-09T07:32:07.000000Z",
                        "updated_at": "2020-09-09T07:32:07.000000Z",
                        "first_name": "Peter",
                        "last_name": "Petrov30",
                        "middle_name": "Petrovich",
                        "biography": "Hello, I am marketing specialist  of Company 30",
                        "full_name": "Peter Petrov30"
                    },
                    "avatar": "https://event-service-backend-dev.truemachine.ru/uploads/previews/avatar-preview.jpeg",
                    "type": "speaker",
                    "is_favorite": false,
                    "city": null,
                    "country": null,
                    "chat_status": "active"
                }
            ],
            "is_favorite": false,
            "is_live": true,
            "track_name": "Technology",
            "marked_type": "like",
            "likes": 1,
            "dislikes": 0,
            "chat_before_live": false,
            "questions_before_live": false,
            "player_before_live": false
        },
        {
            "id": 52,
            "title": "Wendell Green",
            "description": "At et aliquam a omnis vero aliquam aut. Illum eius et nostrum illo et qui.",
            "start": "2020-09-12T08:10:00.000000Z",
            "end": "2020-09-12T09:40:00.000000Z",
            "track_id": 1,
            "category_id": 1,
            "chat_id": 2642,
            "broadcast_url": "http://www.abshire.com/enim-nam-amet-mollitia",
            "embed_code": "75149-6408",
            "can_ask_speaker_before": false,
            "created_at": "2020-09-09T07:34:45.000000Z",
            "updated_at": "2020-09-26T17:21:21.000000Z",
            "speakers": [],
            "is_favorite": false,
            "is_live": true,
            "track_name": "Technology",
            "marked_type": "like",
            "likes": 1,
            "dislikes": 0,
            "chat_before_live": false,
            "questions_before_live": false,
            "player_before_live": false
        }
    ],
    "links": {
        "first": "https://event-service-backend-dev.truemachine.ru/api/sessions/session-lives?page=1",
        "last": "https://event-service-backend-dev.truemachine.ru/api/sessions/session-lives?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://event-service-backend-dev.truemachine.ru/api/sessions/session-lives",
        "per_page": 15000,
        "to": 2,
        "total": 2
    }
}
```
### Получить спикеров, выступающих в определенный день GET /api/session-speakers
```
date = yyyy-mm-dd - пример "date=2020-09-12"
```
Пример, запрос
```
/api/session-speakers?date=2020-09-12
```
Ответ
```
[
    {
        "id": 15,
        "full_name": "Иван Иванов14",
        "avatar": "https://event-service-backend-dev.truemachine.ru/uploads/previews/avatar-preview.jpeg"
    },
    {
        "id": 25,
        "full_name": "Аркадий Лаврентьев24",
        "avatar": "https://event-service-backend-dev.truemachine.ru/uploads/previews/avatar-preview.jpeg"
    }
]
```
### Поставить лайк POST /api/sessions/{id}/like
Код ответа: 200

### Удалить лайк DELETE /api/sessions/{id}/dislike
Код ответа: 204

### Загрузить PDF с программой POST /api/sessions/program/upload-pdf
Код ответа: 200

### Скачать PDF с программой GET /api/sessions/program/download-pdf?locale=
### UPD (19.03.2021) Теперь метод принимает параметры для фильтрации
Код ответа: 200

### Удалить PDF с программой POST /api/sessions/program/remove-pdf
Код ответа: 200

# Notification (Уведомления)
### Список уведомлений. GET /api/notifications
### query params
```
{
   body,
   title,
   sort[name] = id/user_id/read_at/body/created_at
   sort[direction] = asc/desc
}
```
Пример ответа
```
{
    "data": [
        {
            "id": 1,
            "user_id": 5,
            "read_at": "2020-02-25 07:23:58",
            "body": "Autem error dignissimos est consequatur consequuntur error. Et quibusdam ut facere quaerat maxime. Ratione alias amet quo. Dolores omnis rerum fuga sunt reprehenderit debitis.",
            "title": "Red",
            "created_at": "2020-08-12T08:06:43.000000Z",
            "updated_at": "2020-08-12T08:06:43.000000Z",
            "deleted_at": null,
            "user": {
                "id": 5,
                "email": "marina31@example.org",
                "created_at": "2020-08-12T08:06:30.000000Z",
                "updated_at": "2020-08-12T08:06:30.000000Z",
                "deleted_at": null,
                "phone": "(371) 549-0900 x49681",
                "role": [
                    "user"
                ]
            }
        },
        ...
        {
            "id": 52,
            "user_id": 3,
            "read_at": "2020-08-12 11:35:23",
            "body": "And who are you, the proud lord said, that I must bow so low? Only a cat of a different coat, that’s all the truth I know.",
            "title": "DarkGoldenRod",
            "created_at": "2020-08-12T08:49:58.000000Z",
            "updated_at": "2020-08-12T11:35:23.000000Z",
            "deleted_at": null,
            "user": {
                "id": 3,
                "email": "atrantow@example.net",
                "created_at": "2020-08-12T08:06:30.000000Z",
                "updated_at": "2020-08-12T08:06:30.000000Z",
                "deleted_at": null,
                "phone": "654-813-2203",
                "role": [
                    "user"
                ]
            }
        }
    ],
    "links": {
        "first": "http://localhost:8046/api/notifications?page=1",
        "last": "http://localhost:8046/api/notifications?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "http://localhost:8046/api/notifications",
        "per_page": 15000,
        "to": 51,
        "total": 51
    }
}
```
### Уведомление. GET /api/notifications/{id}
Пример ответа
```
{
    "data": {
        "id": 1,
        "user_id": 5,
        "read_at": "2020-02-25 07:23:58",
        "body": "Autem error dignissimos est consequatur consequuntur error. Et quibusdam ut facere quaerat maxime. Ratione alias amet quo. Dolores omnis rerum fuga sunt reprehenderit debitis.",
        "title": "Red",
        "created_at": "2020-08-12T08:06:43.000000Z",
        "updated_at": "2020-08-12T08:06:43.000000Z",
        "deleted_at": null,
        "user": {
            "id": 5,
            "email": "marina31@example.org",
            "created_at": "2020-08-12T08:06:30.000000Z",
            "updated_at": "2020-08-12T08:06:30.000000Z",
            "deleted_at": null,
            "phone": "(371) 549-0900 x49681",
            "role": [
                "user"
            ]
        }
    }
}
```
### Создание уведомления. POST /api/notifications
Тело запроса
```
{
    "user_id": 5,
    "body": "And who are you, the proud lord said, that I must bow so low?",
    "title": "Red",
    
}
```
Пример ответа
```
{
    "data": {
        "user_id": 5,
        "body": "And who are you, the proud lord said, that I must bow so low?",
        "title": "Red",
        "updated_at": "2020-08-12T12:54:34.000000Z",
        "created_at": "2020-08-12T12:54:34.000000Z",
        "id": 53,
        "user": {
            "id": 5,
            "email": "marina31@example.org",
            "created_at": "2020-08-12T08:06:30.000000Z",
            "updated_at": "2020-08-12T08:06:30.000000Z",
            "deleted_at": null,
            "phone": "(371) 549-0900 x49681",
            "role": [
                "user"
            ]
        }
    }
}
```
### Создание уведомлений для некоторых пользователей. POST /api/notification-templates
Тело запроса
```
{
    "title": "Loh",
    "body": "Notification for loh",
    "users": [1, 2, 34]
}
```
Пример ответа
```
{
    "data": {
        "created_by": 1,
        "start_at": null,
        "updated_at": "2020-10-02T15:26:44.000000Z",
        "created_at": "2020-10-02T15:26:44.000000Z",
        "id": 28,
        "title": "Loh",
        "body": "Notification for loh"
    }
}
```
### Удаление уведомления. DELETE /api/notifications/{id}
Пример ответа
```
{
    "data": {
        "id": 53,
        "user_id": 5,
        "read_at": null,
        "body": "And who are you, the proud lord said, that I must bow so low?",
        "title": "Red",
        "created_at": "2020-08-12T12:54:34.000000Z",
        "updated_at": "2020-08-12T12:54:34.000000Z",
        "deleted_at": null,
        "user": {
            "id": 5,
            "email": "marina31@example.org",
            "created_at": "2020-08-12T08:06:30.000000Z",
            "updated_at": "2020-08-12T08:06:30.000000Z",
            "deleted_at": null,
            "phone": "(371) 549-0900 x49681",
            "role": [
                "user"
            ]
        }
    }
}
```
### Обновление уведомления. PUT /api/notifications/{id}
Тело запроса
```
{
    "user_id": 3,
    "body": "And who are you, the proud lord said, that I must bow so low? Only a cat of a different coat, that’s all the truth I know.",
    "title": "DarkGoldenRod"
}
```
Пример ответа
```
{
    "data": {
        "id": 52,
        "user_id": 3,
        "read_at": "2020-08-12 11:35:23",
        "body": "And who are you, the proud lord said, that I must bow so low? Only a cat of a different coat, that’s all the truth I know.",
        "title": "DarkGoldenRod",
        "created_at": "2020-08-12T08:49:58.000000Z",
        "updated_at": "2020-08-12T11:35:23.000000Z",
        "deleted_at": null,
        "user": {
            "id": 3,
            "email": "atrantow@example.net",
            "created_at": "2020-08-12T08:06:30.000000Z",
            "updated_at": "2020-08-12T08:06:30.000000Z",
            "deleted_at": null,
            "phone": "654-813-2203",
            "role": [
                "user"
            ]
        }
    }
}
```
### Прочтение уведомления. PUT /api/notifications/read/{id}
Пример ответа
```
{
    "data": {
        "id": 52,
        "user_id": 3,
        "read_at": "2020-08-12T13:01:21.973948Z",
        "body": "And who are you, the proud lord said, that I must bow so low? Only a cat of a different coat, that’s all the truth I know.",
        "title": "DarkGoldenRod",
        "created_at": "2020-08-12T08:49:58.000000Z",
        "updated_at": "2020-08-12T13:01:21.000000Z",
        "deleted_at": null,
        "user": {
            "id": 3,
            "email": "atrantow@example.net",
            "created_at": "2020-08-12T08:06:30.000000Z",
            "updated_at": "2020-08-12T08:06:30.000000Z",
            "deleted_at": null,
            "phone": "654-813-2203",
            "role": [
                "user"
            ]
        }
    }
}
```
### Прочтение всех уведомлений. PUT /api/notification/read-all
Ответ
```
{
    "readed": 13
}
```
# News (Новости)
### Список новостей. GET /api/news
### query params
```
{
   title,
   body,
   short_description,
   news_id,
   published_by,
   is_published,
   sort[name] = id/published_at/is_published/created_at
   sort[direction] = asc/desc
}
```
Пример ответа
```
    "data": [
        {
            "id": 1,
            "is_published": true,
            "publishing_status": "true",
            "published_at": "2020-02-17 10:09:49",
            "published_by": 93,
            "created_at": "2020-08-12T20:38:23.000000Z",
            "updated_at": "2020-08-12T20:38:23.000000Z",
            "deleted_at": null,
            "title": "Ms.",
            "body": "Et ullam labore temporibus rerum. Deleniti ad sit aut sunt quisquam. Vero officiis consequatur assumenda illo adipisci odit pariatur.",
            "short_description": "Azure",
            "locale_id": 1,
            "news_files": [
                {
                    "id": 1,
                    "news_id": 1,
                    "type": "type_c",
                    "src": "http://wilderman.org/",
                    "created_at": "2020-08-12T20:38:23.000000Z",
                    "updated_at": "2020-08-12T20:38:23.000000Z",
                    "deleted_at": null
                },
                {
                    "id": 2,
                    "news_id": 1,
                    "type": "type_b",
                    "src": "http://yundt.biz/totam-excepturi-nam-repudiandae.html",
                    "created_at": "2020-08-12T20:38:23.000000Z",
                    "updated_at": "2020-08-12T20:38:23.000000Z",
                    "deleted_at": null
                }
            ]
        },
        ....
        {
            "id": 2,
            "is_published": true,
            "publishing_status": "true",
            "published_at": "2020-03-31 12:30:26",
            "published_by": 101,
            "created_at": "2020-08-12T20:38:23.000000Z",
            "updated_at": "2020-08-12T20:38:23.000000Z",
            "deleted_at": null,
            "title": "Mr.",
            "body": "Omnis ut earum eos in odio. Voluptatum similique est et. Molestiae veniam officia quia omnis aut quam velit iste. Iusto maxime voluptas vero aliquam.",
            "short_description": "Bisque",
            "locale_id": 1,
            "news_files": [
                {
                    "id": 3,
                    "news_id": 2,
                    "type": "type_c",
                    "src": "https://www.durgan.net/ut-ea-odit-animi-ad-eaque",
                    "created_at": "2020-08-12T20:38:23.000000Z",
                    "updated_at": "2020-08-12T20:38:23.000000Z",
                    "deleted_at": null,
                    "image_url": "http://web-address/storage/files/D9kJJiGujyGq63yMCmF4gyrKx6Cah3MotZxLR0ZC.jpeg"
                },
                {
                    "id": 4,
                    "news_id": 2,
                    "type": "type_a",
                    "src": "https://www.walter.info/officia-qui-necessitatibus-voluptas",
                    "created_at": "2020-08-12T20:38:23.000000Z",
                    "updated_at": "2020-08-12T20:38:23.000000Z",
                    "deleted_at": null,
                    "image_url": "http://web-address/storage/files/D9kJJiGujyGq63yMCmF4gyrKx6Cah3MotZxLR0ZC.jpeg"
                }
            ]
        }
```
### Новость. GET /api/news/{id}
```
{
    "data": {
        "id": 1,
        "is_published": true,
        "publishing_status": "true",
        "published_at": "2020-02-17 10:09:49",
        "published_by": 93,
        "created_at": "2020-08-12T20:38:23.000000Z",
        "updated_at": "2020-08-12T20:38:23.000000Z",
        "deleted_at": null,
        "title": "Ms.",
        "body": "Et ullam labore temporibus rerum. Deleniti ad sit aut sunt quisquam. Vero officiis consequatur assumenda illo adipisci odit pariatur.",
        "short_description": "Azure",
        "locale_id": 1,
        "news_files": [
            {
                "id": 1,
                "news_id": 1,
                "type": "type_c",
                "src": "http://wilderman.org/",
                "created_at": "2020-08-12T20:38:23.000000Z",
                "updated_at": "2020-08-12T20:38:23.000000Z",
                "deleted_at": null,
                "image_url": "http://web-address/storage/files/D9kJJiGujyGq63yMCmF4gyrKx6Cah3MotZxLR0ZC.jpeg"
            },
            {
                "id": 2,
                "news_id": 1,
                "type": "type_b",
                "src": "http://yundt.biz/totam-excepturi-nam-repudiandae.html",
                "created_at": "2020-08-12T20:38:23.000000Z",
                "updated_at": "2020-08-12T20:38:23.000000Z",
                "deleted_at": null,
                "image_url": "http://web-address/storage/files/D9kJJiGujyGq63yMCmF4gyrKx6Cah3MotZxLR0ZC.jpeg"
            }
        ]
    }
}
```
### Создание новости. POST /api/news
Тело запроса
```
{
    'title' = 'required|string',
    'short_description' = 'required|string',
    'body' = 'required|string',
    'is_published' = 'required|boolean',
    'publishing_status' = 'required|string',
}
```
Пример ответа
```
{
    
"data": {
        "id": 1,
        "is_published": true,
        "publishing_status": "true",
        "published_at": "2020-02-17 10:09:49",
        "published_by": 93,
        "created_at": "2020-08-12T20:38:23.000000Z",
        "updated_at": "2020-08-12T20:38:23.000000Z",
        "deleted_at": null,
        "title": "Ms.",
        "body": "Et ullam labore temporibus rerum. Deleniti ad sit aut sunt quisquam. Vero officiis consequatur assumenda illo adipisci odit pariatur.",
        "short_description": "Azure",
        "locale_id": 1,
        "news_files": [
            {
                "id": 1,
                "news_id": 1,
                "type": "type_c",
                "src": "http://wilderman.org/",
                "created_at": "2020-08-12T20:38:23.000000Z",
                "updated_at": "2020-08-12T20:38:23.000000Z",
                "deleted_at": null,
                "image_url": "http://web-address/storage/files/D9kJJiGujyGq63yMCmF4gyrKx6Cah3MotZxLR0ZC.jpeg"
            },
            {
                "id": 2,
                "news_id": 1,
                "type": "type_b",
                "src": "http://yundt.biz/totam-excepturi-nam-repudiandae.html",
                "created_at": "2020-08-12T20:38:23.000000Z",
                "updated_at": "2020-08-12T20:38:23.000000Z",
                "deleted_at": null,
                "image_url": "http://web-address/storage/files/D9kJJiGujyGq63yMCmF4gyrKx6Cah3MotZxLR0ZC.jpeg"
            }
        ]
    }
}
```
### Обнавление новости. PUT /api/news{id}
Тело запроса
```
{
    'title' = 'required|string',
    'short_description' = 'required|string',
    'body' = 'required|string',
    'is_published' = 'required|boolean',
    'publishing_status' = 'required|string',
}
```
Пример ответа
```
{
    
"data": {
        "id": 1,
        "is_published": true,
        "publishing_status": "true",
        "published_at": "2020-02-17 10:09:49",
        "published_by": 93,
        "created_at": "2020-08-12T20:38:23.000000Z",
        "updated_at": "2020-08-12T20:38:23.000000Z",
        "deleted_at": null,
        "title": "Ms.",
        "body": "Et ullam labore temporibus rerum. Deleniti ad sit aut sunt quisquam. Vero officiis consequatur assumenda illo adipisci odit pariatur.",
        "short_description": "Azure",
        "locale_id": 1,
        "news_files": [
            {
                "id": 1,
                "news_id": 1,
                "type": "type_c",
                "src": "http://wilderman.org/",
                "created_at": "2020-08-12T20:38:23.000000Z",
                "updated_at": "2020-08-12T20:38:23.000000Z",
                "deleted_at": null,
                "image_url": "http://web-address/storage/files/D9kJJiGujyGq63yMCmF4gyrKx6Cah3MotZxLR0ZC.jpeg"
            },
            {
                "id": 2,
                "news_id": 1,
                "type": "type_b",
                "src": "http://yundt.biz/totam-excepturi-nam-repudiandae.html",
                "created_at": "2020-08-12T20:38:23.000000Z",
                "updated_at": "2020-08-12T20:38:23.000000Z",
                "deleted_at": null,
                "image_url": "http://web-address/storage/files/D9kJJiGujyGq63yMCmF4gyrKx6Cah3MotZxLR0ZC.jpeg"
            }
        ]
    }
}
```
### Удаление новости. DELETE /api/news/{id}
Пример ответа
```
{
    
"data": {
        "id": 1,
        "is_published": true,
        "publishing_status": "true",
        "published_at": "2020-02-17 10:09:49",
        "published_by": 93,
        "created_at": "2020-08-12T20:38:23.000000Z",
        "updated_at": "2020-08-12T20:38:23.000000Z",
        "deleted_at": null,
        "title": "Ms.",
        "body": "Et ullam labore temporibus rerum. Deleniti ad sit aut sunt quisquam. Vero officiis consequatur assumenda illo adipisci odit pariatur.",
        "short_description": "Azure",
        "locale_id": 1,
        "news_files": [
            {
                "id": 1,
                "news_id": 1,
                "type": "type_c",
                "src": "http://wilderman.org/",
                "created_at": "2020-08-12T20:38:23.000000Z",
                "updated_at": "2020-08-12T20:38:23.000000Z",
                "deleted_at": null
            },
            {
                "id": 2,
                "news_id": 1,
                "type": "type_b",
                "src": "http://yundt.biz/totam-excepturi-nam-repudiandae.html",
                "created_at": "2020-08-12T20:38:23.000000Z",
                "updated_at": "2020-08-12T20:38:23.000000Z",
                "deleted_at": null
            }
        ]
    }
}
```
### Добавление файла к новости. POST /api/news/file
Тело запроса
```
{
   "news_id": required|integer,
   "file": required|array
}
```
Пример ответа 
```
{
    "data": {
        "type": "image/png",
        "src": "http://localhost:8046/storage/files/WoC5R8TlYg5MH2aEhl33B9txMJHpmuhmNAj8gy0j.png",
        "news_id": 10,
        "updated_at": "2020-08-13T15:28:59.000000Z",
        "created_at": "2020-08-13T15:28:59.000000Z",
        "id": 202,
        "image_url": "http://localhost:8046/storage/http://localhost:8046/storage/files/WoC5R8TlYg5MH2aEhl33B9txMJHpmuhmNAj8gy0j.png"
    }
}
```

### Добавление файла к телу новости. POST /api/news/body-file
Тело запроса
```
{
   "file": required|array
}
```
Пример ответа 
```
[
    {
        "type": "image/jpeg",
        "src": "files/Cgra6e1zxM8ckzIRcNdkyzvdmCs2Nz5TQmfIibp9.jpg",
        "name": "IMG_4890.jpg",
        "updated_at": "2021-03-19T08:15:20.000000Z",
        "created_at": "2021-03-19T08:15:20.000000Z",
        "id": 86,
        "image_url": "http://127.0.0.1:8046/storage/files/Cgra6e1zxM8ckzIRcNdkyzvdmCs2Nz5TQmfIibp9.jpg",
        "is_favorite": false,
        "preview": null,
        "views": 0,
        "published_at": null
    },
    {
        "type": "image/png",
        "src": "files/HZ1ytllXHWPhwAHLReiFnPpozJnhB9DbNle547Ok.png",
        "name": "A46gVQTTAt92pFW447ndYfG2EFByy3XmjduCiBp9.png",
        "updated_at": "2021-03-19T08:15:20.000000Z",
        "created_at": "2021-03-19T08:15:20.000000Z",
        "id": 87,
        "image_url": "http://127.0.0.1:8046/storage/files/HZ1ytllXHWPhwAHLReiFnPpozJnhB9DbNle547Ok.png",
        "is_favorite": false,
        "preview": null,
        "views": 0,
        "published_at": null
    }
]
```


### Удаление файла новости. DELETE /api/news/file/{id}
id - NewsFile
Тело запроса
```
{
   "news_id": required|integer,
   "file": required|file
}
```
Пример ответа 
```
{
    "data": {
        "type": "image/png",
        "src": "http://localhost:8046/storage/files/WoC5R8TlYg5MH2aEhl33B9txMJHpmuhmNAj8gy0j.png",
        "news_id": 10,
        "updated_at": "2020-08-13T15:28:59.000000Z",
        "created_at": "2020-08-13T15:28:59.000000Z",
        "id": 202,
        "image_url": "http://localhost:8046/storage/http://localhost:8046/storage/files/WoC5R8TlYg5MH2aEhl33B9txMJHpmuhmNAj8gy0j.png"
    }
}
```

### Добавить новости в избранное api/favorite/news/{id}
Пример ответа
```
{
    "data": {
        "id": 1,
        "is_published": true,
        "publishing_status": "false",
        "published_at": "2020-02-15 22:58:18",
        "published_by": 80,
        "created_at": "2020-08-14T11:32:20.000000Z",
        "updated_at": "2020-08-14T11:32:20.000000Z",
        "deleted_at": null,
        "title": "Miss",
        "body": "Sequi est esse aut dicta molestiae minima omnis. Libero repudiandae id nulla vel. Harum adipisci recusandae dicta. Molestiae corrupti perferendis autem sapiente et quod accusantium.",
        "short_description": "Sienna",
        "locale_id": 1
    }
}
```

### Удалить новости из избранных DELETE api/favorite/news/{id}
Код ответа 204

### Опубликовать новость POST /api/news/publish/{id}
Пример ответа/ Код ответа 202
```
 "data": {
        "id": 8,
        "is_published": true,
        "publishing_status": true,
        "published_at": "2020-08-20T21:44:49.638990Z",
        "published_by": 24,
        "created_at": "2020-08-17T15:04:57.000000Z",
        "updated_at": "2020-08-20T21:44:49.000000Z",
        "deleted_at": null,
        "title": "Ms.",
        "body": "Sed voluptatem officia quos autem. Id delectus et consectetur. Minus veritatis sequi provident sapiente sit quia et. Qui quas inventore quas et nihil reprehenderit eligendi ut.",
        "short_description": "ForestGreen",
        "locale_id": 1,
        "is_favorite": false
    }
```
### Cнять с публикации новость POST /api/news/remove-publish/{id}
Пример ответа/ Код ответа 202
```
 "data": {
        "id": 8,
        "is_published": false,
        "publishing_status": false,
        "published_at": "2020-08-20T21:44:49.638990Z",
        "published_by": 24,
        "created_at": "2020-08-17T15:04:57.000000Z",
        "updated_at": "2020-08-20T21:44:49.000000Z",
        "deleted_at": null,
        "title": "Ms.",
        "body": "Sed voluptatem officia quos autem. Id delectus et consectetur. Minus veritatis sequi provident sapiente sit quia et. Qui quas inventore quas et nihil reprehenderit eligendi ut.",
        "short_description": "ForestGreen",
        "locale_id": 1,
        "is_favorite": false
    }
```
