тип заявок

This commit is contained in:
2026-02-03 01:00:56 +05:00
parent ba911aa3b9
commit dbe6265ae3

View File

@@ -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 });