Сервис хранит информацию о всех подключенных юнитах, а также информацию о маршрутах отчетов/уведомлений.
- Unit - точка продаж/пиццерия.
- Chat ID - уникальный идентификатор чата в Telegram.
- Маршрут - связка chat ID, юнита и типа отчета.
To run management command, use
python manage.py {command}
Commands:
init_account_roles
- add all account roles.init_report_types
- add all report types.
GET /units/
Query Parameter | Type | Description |
---|---|---|
limit |
int |
Optional. Default is 100 |
offset |
int |
Optional. Default is 0 |
{
"units": [
{
"id": 1,
"name": "Москва 1-1",
"uuid": "b8e7c2a9-563f-4011-b531-3974efc36a48",
"office_manager_account_name": "om_account_msk_1",
"dodo_is_api_account_name": "api_account_msk_1",
"region": "Москва 1"
}
],
"is_end_of_list_reached": true
}
GET /units/name/${unit_name}/
Path Parameter | Type | Description |
---|---|---|
unit_name |
string |
Required. Unit name |
{
"id": 1,
"name": "Москва 1-1",
"uuid": "b8e7c2a9-563f-4011-b531-3974efc36a48",
"office_manager_account_name": "om_account_msk_1",
"dodo_is_api_account_name": "api_account_msk_1",
"region": "Москва 1"
}
GET /units/regions/
Query Parameter | Type | Description |
---|---|---|
limit |
int |
Optional. Default is 100 |
offset |
int |
Optional. Default is 0 |
{
"regions": [
{
"id": 1,
"name": "Москва 1"
}
],
"is_end_of_list_reached": true
}
GET /telegram-chats/
Query Parameter | Type | Description |
---|---|---|
limit |
int |
Optional. Default is 100 |
offset |
int |
Optional. Default is 0 |
{
"telegram_chats": [
{
"title": "Eldos",
"chat_id": 123456
}
],
"is_end_of_list_reached": true
}
POST /telegram-chats/
{
"chat_id": 123456,
"type": "PRIVATE",
"title": "Eldos",
"username": null
}
Body | Type | Description |
---|---|---|
chat_id |
int |
User/Group Telegram ID |
type |
enum |
Choices: PRIVATE /GROUP |
title |
string |
Chat title |
username |
string |
Optional. This field may be omitted. |
- 201 - Created.
- 400 - Invalid field in the body.
- 409 - Chat already exists.
GET /telegram-chats/chat-types/
[
"PRIVATE",
"GROUP"
]
GET /telegram-chats/${chat_id}/
Path Parameter | Type | Description |
---|---|---|
chat_id |
int |
Telegram chat ID |
{
"chat_id": 12345,
"username": "",
"title": "hello",
"type": "Private"
}
PUT /telegram-chats/${chat_id}/
Path Parameter | Type | Description |
---|---|---|
chat_id |
int |
Telegram chat ID |
- 204 - Updated.
- 400 - Invalid request.
- 404 - Chat not found.
GET /report-types/
Query Parameter | Type | Description |
---|---|---|
limit |
int |
Optional. Default is 100 |
offset |
int |
Optional. Default is 0 |
{
"report_types": [
{
"id": 16,
"name": "CANCELED_ORDERS",
"verbose_name": "Отмены заказов"
}
],
"is_end_of_list_reached": false
}
GET /report-types/statistics/
Query Parameter | Type | Description |
---|---|---|
limit |
int |
Optional. Default is 100 |
offset |
int |
Optional. Default is 0 |
{
"report_types": [
{
"id": 777,
"name": "BONUS_SYSTEM",
"verbose_name": "Бонусная система"
}
],
"is_end_of_list_reached": true
}
GET /report-routes/units/
Query Parameter | Type | Description |
---|---|---|
chat_id |
int |
Telegram chat ID |
report_type_id |
int |
Report type ID |
limit |
int |
Optional. Default is 100 |
offset |
int |
Optional. Default is 0 |
{
"unit_ids": [
1,
2,
3
],
"is_end_of_list_reached": true
}
GET /report-routes/telegram-chats/
Query Parameter | Type | Description |
---|---|---|
unit_id |
int |
Unit ID |
report_type_id |
int |
Report type ID |
limit |
int |
Optional. Default is 100 |
offset |
int |
Optional. Default is 0 |
{
"chat_ids": [
1,
2,
3
],
"is_end_of_list_reached": true
}
POST /report-routes/
{
"report_type_id": 0,
"chat_id": 0,
"unit_ids": [
1,
2,
3
]
}
- 201 - Created
- 400 - Bad request
- 403 - Permission to units/report type denied
- 404 - Chat/report type/units do not exist
- 409 - Report type already exists
DELETE /report-routes/
Query Parameter | Type | Description |
---|---|---|
chat_id |
int |
Chat ID |
report_type_id |
int |
Report type ID |
unit_ids |
list[int] |
List of unit IDs |
- 204 - Deleted
GET /users/{$chat_id}/regions/
Query Parameter | Type | Description |
---|---|---|
limit |
int |
Optional. Default is 100 |
offset |
int |
Optional. Default is 0 |
{
"regions": [
{
"id": 1,
"name": "Москва 1"
}
],
"is_end_of_list_reached": true
}
GET /users/{$chat_id}/units/
Query Parameter | Type | Description |
---|---|---|
limit |
int |
Optional. Default is 100 |
offset |
int |
Optional. Default is 0 |
region_id |
int |
Optional. Filter by region ID |
{
"units": [
{
"id": 1,
"name": "Москва 1-1",
"uuid": "000d3a00-b0dc-80d9-11e6-b24faa1bca9f"
}
],
"is_end_of_list_reached": true
}
GET /users/{$chat_id}/report-types/
Query Parameter | Type | Description |
---|---|---|
limit |
int |
Optional. Default is 100 |
offset |
int |
Optional. Default is 0 |
{
"report_types": [
{
"id": 1,
"name": "CANCELED_ORDERS",
"verbose_name": "Отмены заказов"
}
],
"is_end_of_list_reached": true
}
PATCH /users/{$chat_id}/access-code/
{
"access_code": "your access code"
}
- 204 - Updated
- 404 - User/role is not found