feat(notes): личные заметки с drag-and-drop сортировкой

- Новая страница notes.html и контроллер public/js/notes.js
- Таблица user_notes (id, user_id, title, note, tags, color, sort_order)
- Сохранение порядка карточек через PUT /api/notes/reorder
- Личные заметки администратора видны всем, тьюторы — только своим
- Поддержка user_notes в бэкапе и восстановлении (backup-restore.js)
- Обновлена документация AGENTS.md
This commit is contained in:
dev
2026-10-08 15:04:06 +03:00
parent 2a8d8e9902
commit ecfa15e35b
10 changed files with 662 additions and 23 deletions
+14 -3
View File
@@ -5,14 +5,14 @@ const BACKUP_FORMAT_VERSION = 2;
const BACKUP_MIN_FORMAT_VERSION = 1;
const BACKUP_TABLES = [
'groups', 'students', 'entries', 'project_files', 'branches', 'users', 'user_branches',
'user_settings',
'user_settings', 'user_notes',
'group_photos', 'entry_photos', 'modules', 'student_photos', 'share_links', 'photo_jobs',
'lesson_reports', 'lesson_report_versions', 'audit_log', 'notifications',
'notification_reads', 'banned_ips', 'chat_threads', 'chat_messages', 'chat_attachments',
'short_messages', 'feedbacks',
];
const BACKUP_SEQUENCE_TABLES = [
'groups', 'students', 'entries', 'project_files', 'branches', 'users', 'group_photos',
'groups', 'students', 'entries', 'project_files', 'branches', 'users', 'user_notes', 'group_photos',
'entry_photos', 'modules', 'student_photos', 'share_links', 'photo_jobs', 'lesson_reports',
'lesson_report_versions', 'audit_log', 'notifications', 'chat_threads', 'chat_messages',
'chat_attachments', 'short_messages', 'feedbacks',
@@ -547,7 +547,18 @@ function normalizeRestoreData(data) {
value: optText(x.value, 8000),
updated_at: optTs(x.updated_at),
}));
return { groups, students, entries, project_files, settings, branches, users, user_branches, user_settings, entry_photos, student_photos, group_photos, share_links, modules, photo_jobs, lesson_reports, lesson_report_versions, audit_log, notifications, notification_reads, banned_ips, chat_threads, chat_messages, chat_attachments, short_messages, feedbacks };
const user_notes = (data.user_notes || []).map(x => ({
id: reqInt(x.id),
user_id: reqInt(x.user_id),
title: optText(x.title, 200) || '',
note: optText(x.note, 100000) || '',
tags: optText(x.tags, 50000) || '',
color: optText(x.color, 7) || '#2563eb',
sort_order: optInt(x.sort_order, -10000000, 10000000) ?? 0,
created_at: optTs(x.created_at),
updated_at: optTs(x.updated_at),
}));
return { groups, students, entries, project_files, settings, branches, users, user_branches, user_settings, user_notes, entry_photos, student_photos, group_photos, share_links, modules, photo_jobs, lesson_reports, lesson_report_versions, audit_log, notifications, notification_reads, banned_ips, chat_threads, chat_messages, chat_attachments, short_messages, feedbacks };
}
module.exports = {