"""
# Для создателя
Список тестов для объекта:
GET /plans/:id/checks
{
'check_id': str,
'title': str,
'short_desc': str,
'tags': [str],
'desc': str,
}
Создать новый тест для объекта:
POST /plans/:id/checks
{
'user': str(user.id)
'title': str,
'desc': str,
'short_desc': str,
'questions': [question],
'tags': [str]
'check_id' - главный id, заполняется на сервере.
'question_current' - id первого вопроса, заполняется на сервере
}
question_radio
--------------
{
'title': str,
'desc': str,
'next': str,
'type': str,
'answer': str,
'choices': [{
'title': str,
'desc': str,
'cost':str,
}],
}
question_checklist
--------------
{
'title': str,
'desc': str,
'next': str,
'type': str,
'answer': [str],
'choices': [{
'title': str,
'desc': str,
'cost':str,
}],
}
Правка:
PATCH /items/:id/checks/:id
DELETE /items/:id/checks/:id
Один тест:
GET /items/:id/checks/:id
{
'check_id': str,
'title': str,
'short_desc': str,
'tags': [str],
'desc': str,
}
# Для пользователя
Cписок доступных тестов для объекта:
GET /plans/:id/checks
GET /plans/:id/tasks/id/checks
GET /plans/:id/checklists/id/checks
{
'check_id': str,
'title': str,
'short_desc': str,
'tags': [str],
'desc': str,
}
Начать проходить тест:
GET /items/:id/checks/:id/start
(копируем, заполняя user и id)
Вернётся новый id теста {'id': '8734ad2312515'}
{
'check_id': str,
'title': str,
'short_desc': str,
'tags': [str],
'status': str,
'started_ts': datetime,
'tags': [str],
'question_current': str,
'user': user,
}
Список тестов, проходящихся в данный момент:
GET /checks
(фильтр по status и tags - ещё в процессе)
[{
'check_id': str,
'title': str,
'short_desc': str,
'tags': [str],
'desc': str,
}]
Информация о тесте (без вопросов!):
GET /checks/:id
{
'check_id': str,
'title': str,
'short_desc': str,
'tags': [str],
'desc': str,
}
Информация по вопросу:
GET /checks/:id/questions/:id
(id вопроса равен question_current)
question_radio
--------------
{
'id': str,
'title': str,
'desc': str,
'next': str,
'type': str,
'answer': str,
'choices': [{
'id': str,
'title': str,
'desc': str,
'cost':str,
}],
}
question_checklist
--------------
{
'id': str,
'title': str,
'desc': str,
'next': str,
'type': str,
'answer': [str],
'choices': [{
'id': str,
'title': str,
'desc': str,
'cost':str,
}],
}
Отправка ответа:
PATCH /checks/:id/questions/:id
{'answer': 'ljhsdjkhaegv'} => {'next': {следующий вопрос}}
question_radio
--------------
{
'id': str,
'title': str,
'desc': str,
'next': str,
'type': str,
'answer': str,
'choices': [{
'id': str,
'title': str,
'desc': str,
'cost':str,
}],
}
question_checklist
--------------
{
'id': str,
'title': str,
'desc': str,
'next': str,
'type': str,
'answer': [str],
'choices': [{
'id': str,
'title': str,
'desc': str,
'cost':str,
}],
}
Tags:
$plan
$plan-id
$checklist
$checklist-idx
$task
$task-idx
"""