fix: linter
Deploy banu-front / deploy (push) Successful in 1m28s

This commit is contained in:
sajjadtalkhabi
2026-05-28 15:52:48 +03:30
parent 3f3c66a02d
commit 9660e3fe8f
41 changed files with 1669 additions and 1087 deletions
+17 -11
View File
@@ -3,6 +3,7 @@
Source of truth: the Postman collection covering Terms, Courses, Sessions, Exams, Homeworks, Media (2026-05). This doc lists every place where backend and FE disagree on shape, plus FE-side concepts the backend doc has no slot for. Each item needs a product/design call before we wire it up.
Conventions in the rest of this doc:
- **B → FE** means the backend exposes a field/endpoint that the FE doesn't surface yet.
- **FE → B** means the FE shows/sends a field the backend doc doesn't accept.
- **shape diff** means both sides handle the concept but in different shapes (enum values, nesting, naming).
@@ -14,7 +15,7 @@ Conventions in the rest of this doc:
### Endpoints
| Backend | FE today | Status |
|---|---|---|
| --- | --- | --- |
| `GET /terms?per_page&active_only` | `getTermsList` | aligned |
| `GET /terms/:id` | `showTerm` | aligned |
| `POST /terms` | `addNewTerm` | aligned |
@@ -28,7 +29,7 @@ Conventions in the rest of this doc:
### Fields
| Backend → FE | FE has it as | Notes |
|---|---|---|
| --- | --- | --- |
| `starts_at`, `ends_at` (ISO datetime) | `startDate`, `endDate` | Naming diff; we send `starts_at`/`ends_at` in the mock already — confirm the FE form should rename or keep an adapter. |
| `cover_url` (read) + `cover_media_id` (write) | `coverUrl` / `coverMediaId` | aligned in shape, just camelCase. |
| `created_at` | `createdAt` | aligned. |
@@ -36,6 +37,7 @@ Conventions in the rest of this doc:
| `description` | `description` | aligned. |
**FE → B** (need decision):
- `studentsCount`, `coursesCount` — computed UI counts. Backend response doesn't include them. Either compute client-side or ask backend for `?include=counts`.
- `image` (UI alias of cover) — FE keeps this for a fallback. Backend response only has `cover_url`.
@@ -46,7 +48,7 @@ Conventions in the rest of this doc:
### Endpoints
| Backend | FE today | Status |
|---|---|---|
| --- | --- | --- |
| `GET /courses?term_id&per_page` | `getCoursesList` | aligned (drop `/admin/` prefix in `endpoints.js`). |
| `GET /courses/:id` | `showCourse` | aligned. Backend response includes nested `term` and `teacher` — FE already reads `course.term` / `course.teacher`, good. |
| `POST /courses` | `addNewCourse` | aligned. Backend currently requires `term_id` (422 example), but per user instruction the standalone (template-tab) flow must allow `term_id: null`. **Decide:** ask backend to make `term_id` nullable, or refuse to submit until a term is picked. |
@@ -59,7 +61,7 @@ Conventions in the rest of this doc:
### Fields
| Backend ↔ FE | Notes |
|---|---|
| --- | --- |
| `term_id``termId` | aligned. Nullable in CourseFormPage, required in AddOfferedCourseModal — schema reflects this. |
| `teacher_id``teacherId` | aligned. |
| `capacity``capacity` | aligned. |
@@ -69,6 +71,7 @@ Conventions in the rest of this doc:
| Nested `term`, `teacher` on show response | FE already reads. |
**FE → B** (need decision):
- `sessionsCount` — number-of-sessions field on the create form. Backend has nothing. Either compute server-side from related sessions, or drop the field.
- `prerequisites` (array of { courseId, course }) — backend has no prerequisite relation. Drop or ask backend for it.
- `contentType` (video/voice/text) + `contentMediaId` — single course-level content file. Backend treats files only as session media. Decide whether course-level content should move to "intro session" or stay a course concept.
@@ -81,7 +84,7 @@ Conventions in the rest of this doc:
### Endpoints
| Backend | FE today | Status |
|---|---|---|
| --- | --- | --- |
| `GET /sessions?course_id&per_page` | `getSessionsList` | aligned. |
| `GET /sessions/:id` | `showSession` | aligned. |
| `POST /sessions` | `addNewSession` | aligned. |
@@ -93,7 +96,7 @@ Conventions in the rest of this doc:
### Fields — biggest gap of all five resources
| Backend | FE today | Notes |
|---|---|---|
| --- | --- | --- |
| `type` enum: `online \| offline \| content` | `sessionType` enum: `in_person`, `online`, `video`, `audio`, `text`, `slide`, `pdf` | **Shape diff.** FE has 7 values; backend has 3. There's an existing `SESSION_TYPE_TO_SPEC` mapper in `services/mock/fixtures/admin-sessions.js`. Decide whether the FE keeps the richer 7-value enum (and we map down to backend's 3) or collapses. |
| `starts_at`, `location`, `link` | All three live **inside** `form.sessionConfig.*` plus also derived to top-level `startsAt` / `location` / `link` in the mock | **Structural diff.** Backend wants flat fields; FE form nests them under `sessionConfig` keyed by `sessionType`. The mock derives top-level from `sessionConfig.*` for show payloads. Decide whether the FE form should flatten the schema to match backend or keep the conditional-by-type config UI. |
| `media_ids[]` (write) / `media[]` (read with `collection_name`, `file_name`, `mime_type`, `file_size`, `url`, `download_url`) | `materials[]` with `{ fileId, isRequired, type, title, order }` | **Shape diff.** Backend's media rows are typed by upload-purpose (video/voice/pdf/slide/attachment); FE has its own `type` enum. Decide which shape the FE keeps. |
@@ -108,7 +111,7 @@ Conventions in the rest of this doc:
### Endpoints
| Backend | FE today | Status |
|---|---|---|
| --- | --- | --- |
| `GET /exams/:id` (with questions+options) | `showExam` | aligned. |
| `POST /exams` | `addNewExam` | aligned. |
| `PATCH /exams/:id` | `updateExam` | aligned. |
@@ -122,7 +125,7 @@ Conventions in the rest of this doc:
### Fields
| Backend ↔ FE | Notes |
|---|---|
| --- | --- | --- |
| `session_id``sessionId` | aligned. |
| `title``title` | aligned. |
| `description``description` | aligned. |
@@ -131,6 +134,7 @@ Conventions in the rest of this doc:
| Backend question shape: `{ question_text, position, options: [{ option_text, is_correct }] }` | FE: `{ title, score, correctAnswerId, answers: [{ id, title }] }` | **Shape diff.** Backend hides `is_correct` from public reads (only on add). FE concept of `score` (per-question weighting) has no backend slot. Decide: keep FE scoring (ask backend to store) or drop. |
**FE → B** (need decision):
- `durationMinutes` — no backend slot.
- `randomize` — no backend slot.
- `endDate` / `startDate` — exam validity window, no backend slot.
@@ -143,7 +147,7 @@ Conventions in the rest of this doc:
### Endpoints
| Backend | FE today | Status |
|---|---|---|
| --- | --- | --- |
| `POST /homeworks` | `addNewAssignment` | aligned (URL renamed to `/homeworks`; FE key name kept). |
| `PATCH /homeworks/:id` | `updateAssignment` | aligned. |
| `DELETE /homeworks/:id` | `deleteAssignment` | aligned. |
@@ -155,7 +159,7 @@ Conventions in the rest of this doc:
### Fields
| Backend ↔ FE | Notes |
|---|---|
| --- | --- | --- |
| `session_id``sessionId` | aligned. |
| `title`, `description` | aligned. |
| `deadline` (single datetime) | FE: `startDate` + `endDate` + computed `durationDays` | **Shape diff.** Backend has one deadline; FE has a window. Decide: drop start/end and use single deadline, or ask backend to add a window. |
@@ -166,6 +170,7 @@ Conventions in the rest of this doc:
| Submission `reviewed_at` (read) | — | Backend provides; FE doesn't surface. |
**FE → B** (need decision):
- `priority` enum (`mandatory \| optional`) — no backend slot.
- `submissionsCount` — derived count, no backend slot.
@@ -176,7 +181,7 @@ Conventions in the rest of this doc:
### Endpoints
| Backend | FE today | Status |
|---|---|---|
| --- | --- | --- |
| `POST /media` (multipart with `purpose` + `file`) | `uploadMedia` | aligned URL & method. |
| `GET /media/:id/download` | — | **Backend → FE.** Add as `downloadMedia`. |
| `DELETE /media/:id` | — | **Backend → FE.** Add as `deleteMedia`. |
@@ -194,6 +199,7 @@ Conventions in the rest of this doc:
### Snake_case vs camelCase
Backend wire format is snake_case throughout. FE today reads camelCase (e.g., the mock returns `coverUrl`, `isActive`). When the real backend lands, the FE will either need:
- a HTTP-layer transformer (camelize on response, snake_case on request), or
- camelCase field aliases on the backend serializer.