feat: Add comprehensive API usage examples for v3, ERD, data dictionary, and course cloning documentation.

This commit is contained in:
JakkrapartXD 2026-01-07 10:42:39 +07:00
parent 6c4d10963e
commit a1f7ee057d
9 changed files with 1661 additions and 10 deletions

View file

@ -18,8 +18,8 @@ Authorization: Bearer <token>
### Authentication
| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| POST | `/auth/register` | - | Register new user |
| POST | `/auth/login` | - | Login |
| POST | `/auth/register` | - | Register new user (username + email) |
| POST | `/auth/login` | - | Login (username OR email) |
| POST | `/auth/logout` | ✅ | Logout |
| POST | `/auth/refresh` | ✅ | Refresh token |
| POST | `/auth/password/reset-request` | - | Request password reset |
@ -28,8 +28,9 @@ Authorization: Bearer <token>
### User Profile
| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| GET | `/users/me` | ✅ | Get current user profile |
| PUT | `/users/me` | ✅ | Update profile |
| GET | `/users/me` | ✅ | Get current user info |
| GET | `/users/me/profile` | ✅ | Get user profile details |
| PUT | `/users/me/profile` | ✅ | Update profile (name, phone, avatar) |
| PUT | `/users/me/password` | ✅ | Change password |
### User Management (Admin)
@ -40,6 +41,12 @@ Authorization: Bearer <token>
| PUT | `/admin/users/:userId/role` | 🔒 Admin | Update user role |
| DELETE | `/admin/users/:userId` | 🔒 Admin | Deactivate user |
### Role Management (Admin)
| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| GET | `/admin/roles` | 🔒 Admin | List all roles |
| GET | `/admin/roles/:roleId` | 🔒 Admin | Get role details |
---
## 2. Categories
@ -83,6 +90,15 @@ Authorization: Bearer <token>
| PUT | `/instructor/courses/:courseId` | 👨‍🏫 Instructor | Update course |
| DELETE | `/instructor/courses/:courseId` | 👨‍🏫 Instructor | Delete course |
| POST | `/instructor/courses/:courseId/submit` | 👨‍🏫 Instructor | Submit for approval |
| POST | `/instructor/courses/:courseId/clone` | 👨‍🏫 Instructor | Clone course (copy all content) |
### Course Instructors
| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| GET | `/instructor/courses/:courseId/instructors` | 👨‍🏫 Instructor | List course instructors |
| POST | `/instructor/courses/:courseId/instructors` | 👨‍🏫 Instructor | Add instructor to course |
| DELETE | `/instructor/courses/:courseId/instructors/:userId` | 👨‍🏫 Instructor | Remove instructor |
| PUT | `/instructor/courses/:courseId/instructors/:userId/primary` | 👨‍🏫 Instructor | Set as primary instructor |
---
@ -166,8 +182,8 @@ Authorization: Bearer <token>
|--------|----------|------|-------------|
| GET | `/students/progress` | 👨‍🎓 Student | Get my overall progress |
| GET | `/students/courses/:courseId/progress` | 👨‍🎓 Student | Get course progress |
| GET | `/students/courses/:courseId/certificate` | 👨‍🎓 Student | Get certificate |
| GET | `/students/certificates` | 👨‍🎓 Student | Get all certificates |
| GET | `/students/courses/:courseId/certificate` | 👨‍🎓 Student | Get certificate (PDF file_path) |
| GET | `/students/certificates` | 👨‍🎓 Student | Get all my certificates |
### Instructor Reports
| Method | Endpoint | Auth | Description |
@ -311,15 +327,15 @@ Authorization: Bearer <token>
---
## Total Endpoints: **96+**
## Total Endpoints: **107+**
- Authentication: 6
- User Management: 4
- User Management: 6 (+2 profile, +2 roles)
- Categories: 5
- Courses: 14 (+2)
- Courses: 19 (+4 instructors, +1 clone)
- Chapters & Lessons: 16
- Quizzes: 10
- Announcements: 7 (+1)
- Announcements: 7
- Reports: 11
- Orders & Payments: 7 (อนาคต)
- Earnings & Withdrawals: 8 (อนาคต)