Remove duplicate checklists functionality
Checklists were duplicating subtasks functionality. Removed: - Migration for task_checklists table - TaskChecklistModel - Checklist methods from TaskService - Checklist routes from Routes.php - Checklist controller methods - Checklist UI section from show.twig - Checklist JavaScript functions Updated TASKS_MODULE_ROADMAP.md
This commit is contained in:
@@ -614,108 +614,4 @@ class TasksController extends BaseController
|
||||
'success' => $result,
|
||||
]);
|
||||
}
|
||||
|
||||
// ========== Чек-листы (Checklists) ==========
|
||||
|
||||
/**
|
||||
* API: добавить элемент чек-листа
|
||||
*/
|
||||
public function addChecklistItem(int $taskId)
|
||||
{
|
||||
if (!$this->access->canEdit('tasks')) {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'error' => 'Нет прав для изменения задач'
|
||||
]);
|
||||
}
|
||||
|
||||
$organizationId = $this->requireActiveOrg();
|
||||
$userId = $this->getCurrentUserId();
|
||||
|
||||
$title = trim($this->request->getPost('title'));
|
||||
if (empty($title)) {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'error' => 'Название элемента чек-листа обязательно'
|
||||
]);
|
||||
}
|
||||
|
||||
// Проверяем что задача принадлежит организации
|
||||
$task = $this->taskService->getTask($taskId, $organizationId);
|
||||
if (!$task) {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'error' => 'Задача не найдена'
|
||||
]);
|
||||
}
|
||||
|
||||
$checklistId = $this->taskService->addChecklistItem($taskId, $title, $userId);
|
||||
|
||||
return $this->response->setJSON([
|
||||
'success' => (bool) $checklistId,
|
||||
'checklist_id' => $checklistId,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* API: переключить статус элемента чек-листа
|
||||
*/
|
||||
public function toggleChecklistItem(int $taskId, int $checklistId)
|
||||
{
|
||||
if (!$this->access->canEdit('tasks')) {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'error' => 'Нет прав для изменения задач'
|
||||
]);
|
||||
}
|
||||
|
||||
$organizationId = $this->requireActiveOrg();
|
||||
$userId = $this->getCurrentUserId();
|
||||
|
||||
// Проверяем что задача принадлежит организации
|
||||
$task = $this->taskService->getTask($taskId, $organizationId);
|
||||
if (!$task) {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'error' => 'Задача не найдена'
|
||||
]);
|
||||
}
|
||||
|
||||
$result = $this->taskService->toggleChecklistItem($taskId, $checklistId, $userId);
|
||||
|
||||
return $this->response->setJSON([
|
||||
'success' => $result,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* API: удалить элемент чек-листа
|
||||
*/
|
||||
public function deleteChecklistItem(int $taskId, int $checklistId)
|
||||
{
|
||||
if (!$this->access->canEdit('tasks')) {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'error' => 'Нет прав для изменения задач'
|
||||
]);
|
||||
}
|
||||
|
||||
$organizationId = $this->requireActiveOrg();
|
||||
$userId = $this->getCurrentUserId();
|
||||
|
||||
// Проверяем что задача принадлежит организации
|
||||
$task = $this->taskService->getTask($taskId, $organizationId);
|
||||
if (!$task) {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'error' => 'Задача не найдена'
|
||||
]);
|
||||
}
|
||||
|
||||
$result = $this->taskService->deleteChecklistItem($taskId, $checklistId, $userId);
|
||||
|
||||
return $this->response->setJSON([
|
||||
'success' => $result,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user