docs: вложения статей (doc_files), подписи и библиотека картинок, быстрое ред. отзыва

This commit is contained in:
dev
2026-11-01 11:06:23 +03:00
parent a6f5953c61
commit 9a509fa742
12 changed files with 947 additions and 25 deletions
+14 -3
View File
@@ -19,14 +19,14 @@ const BACKUP_TABLES = [
'lesson_reports', 'lesson_report_versions', 'audit_log', 'notifications',
'notification_reads', 'banned_ips', 'chat_threads', 'chat_messages', 'chat_attachments',
'short_messages', 'feedbacks', 'bookmarks', 'student_face_refs', 'photo_faces',
'student_work_marks', 'achievement_types', 'student_achievements', 'doc_sections', 'doc_articles', 'doc_images',
'student_work_marks', 'achievement_types', 'student_achievements', 'doc_sections', 'doc_articles', 'doc_images', 'doc_files',
];
const BACKUP_SEQUENCE_TABLES = [
'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', 'bookmarks', 'student_face_refs', 'photo_faces',
'student_work_marks', 'achievement_types', 'student_achievements', 'doc_sections', 'doc_articles', 'doc_images',
'student_work_marks', 'achievement_types', 'student_achievements', 'doc_sections', 'doc_articles', 'doc_images', 'doc_files',
];
function isSupportedBackupVersion(data) {
@@ -687,6 +687,17 @@ function normalizeRestoreData(data) {
id: reqInt(x.id),
article_id: x.article_id == null ? null : reqInt(x.article_id),
path: optUploadPath(x.path, 300) || '',
caption: optText(x.caption, 300) || null,
uploaded_by: x.uploaded_by == null ? null : reqInt(x.uploaded_by),
created_at: optTs(x.created_at),
})).filter(x => x.path);
const docFiles = (data.doc_files || []).map(x => ({
id: reqInt(x.id),
article_id: x.article_id == null ? null : reqInt(x.article_id),
name: optText(x.name, 300) || '',
path: optUploadPath(x.path, 300) || '',
size_bytes: x.size_bytes == null ? null : reqInt(x.size_bytes),
mime: optText(x.mime, 120) || null,
uploaded_by: x.uploaded_by == null ? null : reqInt(x.uploaded_by),
created_at: optTs(x.created_at),
})).filter(x => x.path);
@@ -713,7 +724,7 @@ function normalizeRestoreData(data) {
created_at: optTs(x.created_at),
updated_at: optTs(x.updated_at),
})).filter(x => x.source_id && x.photo_path);
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, bookmarks, achievement_types: achievementTypes, student_achievements: studentAchievements, student_face_refs: faceRefs, photo_faces: faceRows, student_work_marks, doc_sections: docSections, doc_articles: docArticles, doc_images: docImages };
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, bookmarks, achievement_types: achievementTypes, student_achievements: studentAchievements, student_face_refs: faceRefs, photo_faces: faceRows, student_work_marks, doc_sections: docSections, doc_articles: docArticles, doc_images: docImages, doc_files: docFiles };
}
module.exports = {