feat(materials): Фаза 2 — коллекции (папки), поиск и фильтры

- Миграция 061: material_collections + student_materials.collection_id (ON DELETE SET NULL) + tags.
- API: CRUD коллекций (/api/materials/collections), GET /materials отдаёт {materials, collections}
  со счётчиками; PATCH /materials/:id принимает collection_id/tags. Хелперы в js/api.js.
- /my-materials: бар папок (Все/папки/Без папки/+папка) с фильтром, поиск по тексту, фильтр по типу,
  перенос материала в папку (select на карточке), создание/переименование/удаление папок.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maxim Dolgolyov
2026-06-04 12:04:51 +03:00
parent fd3e5c47e8
commit 2c7e97406a
5 changed files with 251 additions and 35 deletions
+8
View File
@@ -8,6 +8,14 @@ router.use(authMiddleware);
router.get('/', c.list);
router.post('/', c.create);
// Collections (folders) — literal '/collections' prefix before '/:id'
router.post('/collections', c.createCollection);
// @public-by-design: router-level authMiddleware (above) + per-row ownership check in handler
router.patch('/collections/:id', c.updateCollection);
// @public-by-design: router-level authMiddleware (above) + per-row ownership check in handler
router.delete('/collections/:id', c.deleteCollection);
// @public-by-design: router-level authMiddleware (above) + per-row ownership check in handler
router.patch('/:id', c.update);
// @public-by-design: router-level authMiddleware (above) + per-row ownership check in handler