Enhance course management by adding 'featured' and 'sort_order' fields to the database schema and related components. Update course filtering and display logic to prioritize featured courses in the catalog. Modify admin interfaces for course creation and editing to include new fields, ensuring proper handling in both the frontend and backend. Update documentation to reflect these changes.

This commit is contained in:
smhk1376 committed 2026-10-22 13:23:43 +03:30
1 parent 1641edfd01
commit 4b84409ed7
43 files changed
+703 -155

No files matched your search

+7 -1
View File
@@ -76,7 +76,7 @@ node scripts/test-db-connection.mjs
| جدول | نکته |
|---|---|
| `courses` | `category`/`format` با CHECK؛ `slug` UNIQUE؛ `price` اختیاری (تومان، NULL = مخفی در UI) |
| `courses` | `format` با CHECK؛ `slug` UNIQUE؛ `price` اختیاری؛ `featured` + `sort_order` (migration 011) |
| `programs` | `group_key` (به‌جای reserve واژهٔ `group`)؛ `highlights` JSONB |
| `events` | `start_date`/`end_date` DATE؛ `end_date` NULL = تک‌روزه |
| `articles` | `featured` + ایندکس جزئی `articles_one_featured` (حداکثر یک مقالهٔ published با `featured=true`) |
@@ -98,6 +98,12 @@ node scripts/test-db-connection.mjs
- `idx_programs_title` / `idx_courses_title` روی `(published, title)`.
- `courses.slug`, `programs.slug`, `intersection_topics.slug` از 001 UNIQUE هستند و ایندکس جزئی `articles_one_featured` از 001 موجود است — تکرار نشده‌اند.
## اولویت کاتالوگ (011)
- Migration: `db/migrations/011_course_priority.sql`.
- `courses.featured BOOLEAN NOT NULL DEFAULT false` و `courses.sort_order INT NOT NULL DEFAULT 0`.
- لیست عمومی: غیرآرشیو (`tag-archive`) سپس ویژه سپس `sort_order` سپس عنوان. آرشیو با تگ جدا می‌شود، نه با ستون جدید.
## Admin (فاز E — 2026-09-22)
- مکانیزم: `admin_users` (رمز با scrypt در `password_hash`، هرگز plaintext) + `admin_sessions` (توکن تصادفی؛ `token_hash` در DB ذخیره می‌شود؛ cookie فقط `admin_session` HttpOnly/SameSite=Lax).