1
0

Добавление проектов

Добавили возможность создавания разных проектов.
This commit is contained in:
2026-01-14 10:46:38 +07:00
parent 04e88cb7fa
commit 719aecd09e
22 changed files with 996 additions and 233 deletions

View File

@@ -7,24 +7,6 @@ if ($method === 'POST') {
$action = $data['action'] ?? null;
$task = new Task();
// Получение колонок
if ($action === 'get_columns') {
$result = $task->getColumns();
RestApi::response(['success' => true, 'data' => $result]);
}
// Получение департаментов
if ($action === 'get_departments') {
$result = $task->getDepartments();
RestApi::response(['success' => true, 'data' => $result]);
}
// Получение меток
if ($action === 'get_labels') {
$result = $task->getLabels();
RestApi::response(['success' => true, 'data' => $result]);
}
// Загрузка изображения
if ($action === 'upload_image') {
$task_id = $data['task_id'] ?? null;
@@ -73,6 +55,7 @@ if ($method === 'POST') {
// Создание задачи
if ($action === 'create') {
$task->id_project = $data['id_project'] ?? null;
$task->id_department = $data['id_department'] ?? null;
$task->id_label = $data['id_label'] ?? null;
$task->id_account = $data['id_account'] ?? null;
@@ -110,8 +93,15 @@ if ($method === 'POST') {
}
if ($method === 'GET') {
// Получение всех задач
// Получение задач проекта
// ?id_project=1 (обязательный)
// ?archive=0 (неархивные, по умолчанию), ?archive=1 (архивные), ?archive=all (все)
$id_project = $_GET['id_project'] ?? null;
if (!$id_project) {
RestApi::response(['success' => false, 'errors' => ['id_project' => 'Проект не указан']], 400);
}
$archive = $_GET['archive'] ?? 0;
if ($archive === 'all') {
$archive = null;
@@ -120,7 +110,7 @@ if ($method === 'GET') {
}
$task = new Task();
$tasks = $task->getAll($archive);
$tasks = $task->getAll($id_project, $archive);
RestApi::response(['success' => true, 'data' => $tasks]);
}