dbeee44fc7
Triples the catalogue from 10 to 32 active items so coins finally have
somewhere to land. Migration 033 seeds:
• 12 new frames at 200-1200 coin tiers (морская, лесная, закат,
минимал, винтаж, пиксельный, молния, космос, изумруд, призрак,
кибер, золотой ободок) — each with curated CSS that renders
correctly in the shop preview added in Phase 4
• 9 new titles at 150-2000 coin tiers (стажёр, аналитик, геометр,
алгебраист, физик, олимпиец, боссфайтер, магистр, профессор)
— colored pills that pair with the new title preview UI
• 1 new theme (тёплая бумага) using the existing active_theme slot
Effects are intentionally not extended in this migration — js/api.js
_applyEffect() only knows pulse/sparkle/snow today, and adding new
effect kinds belongs in a follow-up that updates the renderer in
tandem with the catalogue entries.
Re-runnable: each row is gated by WHERE NOT EXISTS (name, type) so
re-applying the migration on a partially-seeded environment is safe.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
LearnSpace Backend — Фаза 1
Быстрый старт
cd backend
npm install
# 1. Скопировать и заполнить переменные окружения
cp .env.example .env
# 2. Создать базу данных в PostgreSQL
createdb learnspace
# 3. Применить миграции (создать таблицы)
npm run migrate
# 4. Загрузить тестовые вопросы
npm run seed
# 5. Запустить сервер
npm run dev
API
Auth
| Метод | URL | Тело | Описание |
|---|---|---|---|
| POST | /api/auth/register |
{ email, password, name } |
Регистрация |
| POST | /api/auth/login |
{ email, password } |
Вход |
| GET | /api/auth/me |
— | Текущий пользователь |
Предметы
| Метод | URL | Описание |
|---|---|---|
| GET | /api/subjects |
Список предметов |
| GET | /api/subjects/:slug/topics |
Темы предмета |
Сессии тестирования
| Метод | URL | Тело | Описание |
|---|---|---|---|
| POST | /api/sessions |
{ subject_slug, mode, count, topic_id? } |
Начать тест |
| POST | /api/sessions/:id/answer |
{ question_id, option_id, time_spent_sec? } |
Отправить ответ |
| POST | /api/sessions/:id/finish |
— | Завершить тест + разбор |
| GET | /api/sessions/:id/result |
— | Результат завершённого теста |
| GET | /api/sessions/history |
— | История тестов |
Все /api/sessions/* требуют заголовок:
Authorization: Bearer <token>
Добавление вопросов
Создать JSON-файл в data/ по образцу questions-bio.json:
{
"subject": "chem",
"topics": [{ "name": "Органическая химия", "order": 1 }],
"questions": [
{
"topic": "Органическая химия",
"difficulty": 2,
"text": "Текст вопроса",
"options": ["А", "Б", "В", "Г"],
"answer": 0,
"explanation": "Объяснение правильного ответа"
}
]
}
Затем повторно запустить npm run seed.
Структура проекта
backend/
├── data/ ← JSON с вопросами
├── src/
│ ├── server.js ← точка входа
│ ├── middleware/auth.js ← JWT верификация
│ ├── db/
│ │ ├── pool.js ← соединение с PostgreSQL
│ │ ├── migrate.js ← запуск миграций
│ │ ├── seed.js ← загрузка вопросов
│ │ └── migrations/ ← SQL-файлы схемы
│ ├── routes/ ← маршруты
│ └── controllers/ ← бизнес-логика
└── .env.example