feat: add enrolled student detail endpoint and reorder student endpoints

Add getEnrolledStudentDetail endpoint to retrieve individual student's lesson progress across all course chapters. Move searchStudents endpoint before getEnrolledStudentDetail to prevent route conflicts. Remove correct_choice_id and correct_choice_text from quiz attempt detail answers review. Fix selected_choice_id mapping to use choice_id from student answers.
This commit is contained in:
JakkrapartXD 2026-02-03 14:42:45 +07:00
parent 12e71c48b4
commit 7749a39be7
3 changed files with 252 additions and 34 deletions

View file

@ -317,8 +317,6 @@ export interface QuizAttemptDetailData {
question_text: MultiLanguageText;
selected_choice_id: number | null;
selected_choice_text: MultiLanguageText | null;
correct_choice_id: number;
correct_choice_text: MultiLanguageText;
is_correct: boolean;
score: number;
question_score: number;
@ -331,6 +329,63 @@ export interface GetQuizAttemptDetailResponse {
data: QuizAttemptDetailData;
}
// ============================================
// Enrolled Student Detail (Instructor)
// ============================================
export interface GetEnrolledStudentDetailInput {
token: string;
course_id: number;
student_id: number;
}
export interface LessonProgressDetail {
lesson_id: number;
lesson_title: MultiLanguageText;
lesson_type: string;
sort_order: number;
is_completed: boolean;
completed_at: Date | null;
video_progress_seconds: number | null;
video_duration_seconds: number | null;
video_progress_percentage: number | null;
last_watched_at: Date | null;
}
export interface ChapterProgressDetail {
chapter_id: number;
chapter_title: MultiLanguageText;
sort_order: number;
lessons: LessonProgressDetail[];
completed_lessons: number;
total_lessons: number;
}
export interface EnrolledStudentDetailData {
student: {
user_id: number;
username: string;
email: string;
first_name: string | null;
last_name: string | null;
avatar_url: string | null;
};
enrollment: {
enrolled_at: Date;
progress_percentage: number;
status: string;
};
chapters: ChapterProgressDetail[];
total_completed_lessons: number;
total_lessons: number;
}
export interface GetEnrolledStudentDetailResponse {
code: number;
message: string;
data: EnrolledStudentDetailData;
}
// ============================================
// Search Students in Course (Instructor)
// ============================================