feat(lessons): «Быстрый урок» — одиночный урок без ручного создания курса
Учитель жмёт «Быстрый урок» в каталоге (theory.html) → урок создаётся в скрытом личном курсе-контейнере и сразу открывается редактор. Возни с курсом нет. - Миграция 059: courses.is_personal (ADD COLUMN). - POST /api/lessons/quick (teacher/admin): get-or-create личный контейнер (is_personal=1, один на учителя, опубликован) + создаёт урок, возвращает lessonId. - Каталог курсов скрывает личные контейнеры от всех, кроме владельца (courseController.list). - Свои быстрые уроки учитель видит как курс «Мои материалы» (открыв его в каталоге). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -45,6 +45,10 @@ function list(req, res) {
|
||||
let where = role === 'student' ? 'WHERE c.is_published = 1' : 'WHERE 1=1';
|
||||
const args = [];
|
||||
if (subject) { where += ' AND c.subject_slug = ?'; args.push(subject); }
|
||||
// Personal "container" courses (quick lessons) are hidden from the catalog;
|
||||
// their owner still sees their own.
|
||||
if (role === 'student') { where += ' AND c.is_personal = 0'; }
|
||||
else { where += ' AND (c.is_personal = 0 OR c.created_by = ?)'; args.push(uid); }
|
||||
|
||||
const rows = db.prepare(`
|
||||
SELECT c.*,
|
||||
|
||||
Reference in New Issue
Block a user