From dbe6265ae3bb9cb2a40d80c540de0db354372ad3 Mon Sep 17 00:00:00 2001 From: kalugin66 Date: Tue, 3 Feb 2026 01:00:56 +0500 Subject: [PATCH] =?UTF-8?q?=D1=82=D0=B8=D0=BF=20=D0=B7=D0=B0=D1=8F=D0=B2?= =?UTF-8?q?=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- task-endpoints.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/task-endpoints.js b/task-endpoints.js index 4356801..0544ebf 100644 --- a/task-endpoints.js +++ b/task-endpoints.js @@ -714,11 +714,12 @@ app.get('/api/document-approval-tasks', requireAuth, (req, res) => { db.serialize(() => { const startDate = new Date().toISOString(); - + const taskType = req.body.taskType || 'regular'; + db.run( - "INSERT INTO tasks (title, description, created_by, original_task_id, start_date, due_date) VALUES (?, ?, ?, ?, ?, ?)", - [title, description, createdBy, originalTaskId || null, startDate, dueDate || null], - function(err) { + "INSERT INTO tasks (title, description, created_by, original_task_id, start_date, due_date, task_type) VALUES (?, ?, ?, ?, ?, ?, ?)", + [title, description, createdBy, originalTaskId || null, startDate, dueDate || null, taskType], + function(err) { if (err) { res.status(500).json({ error: err.message }); return; @@ -807,8 +808,8 @@ app.get('/api/document-approval-tasks', requireAuth, (req, res) => { const startDate = new Date().toISOString(); db.run( - "INSERT INTO tasks (title, description, created_by, original_task_id, start_date, due_date) VALUES (?, ?, ?, ?, ?, ?)", - [newTitle, originalTask.description, createdBy, taskId, startDate, dueDate || null], + "INSERT INTO tasks (title, description, created_by, original_task_id, start_date, due_date, task_type) VALUES (?, ?, ?, ?, ?, ?, ?)", + [newTitle, originalTask.description, createdBy, taskId, startDate, dueDate || null, originalTask.task_type || 'regular'], function(err) { if (err) { res.status(500).json({ error: err.message }); @@ -890,11 +891,11 @@ app.get('/api/document-approval-tasks', requireAuth, (req, res) => { if (!canUserEditTask(task, req.session.user)) { return res.status(403).json({ error: 'У вас нет прав для редактирования этой задачи' }); } - + const taskType = req.body.taskType || 'regular'; db.serialize(() => { db.run( - "UPDATE tasks SET title = ?, description = ?, due_date = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?", - [title, description, dueDate || null, taskId], + "UPDATE tasks SET title = ?, description = ?, due_date = ?, task_type = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?", + [title, description, dueDate || null, taskType, taskId], function(err) { if (err) { res.status(500).json({ error: err.message });