feat: add instructor endpoints for student progress tracking and quiz score management
Add four new instructor endpoints: getEnrolledStudents to view all enrolled students with progress, getQuizScores to view quiz scores for all students in a lesson, getQuizAttemptDetail to view detailed quiz attempt for a specific student, and searchStudents to search enrolled students by name/email/username. Add getQuizAttempts endpoint for students to retrieve their own quiz attempt history. All endpoints include
This commit is contained in:
parent
a648c41b72
commit
80d7372dfa
6 changed files with 832 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ import {
|
|||
CompleteLessonResponse,
|
||||
SubmitQuizResponse,
|
||||
SubmitQuizBody,
|
||||
GetQuizAttemptsResponse,
|
||||
} from '../types/CoursesStudent.types';
|
||||
import { EnrollmentStatus } from '@prisma/client';
|
||||
|
||||
|
|
@ -234,4 +235,32 @@ export class CoursesStudentController {
|
|||
answers: body.answers,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ดึงคะแนน Quiz ที่เคยทำ
|
||||
* Get quiz attempts and scores for a lesson
|
||||
* @param courseId - รหัสคอร์ส / Course ID
|
||||
* @param lessonId - รหัสบทเรียน / Lesson ID
|
||||
*/
|
||||
@Get('courses/{courseId}/lessons/{lessonId}/quiz/attempts')
|
||||
@Security('jwt', ['student'])
|
||||
@SuccessResponse('200', 'Quiz attempts retrieved successfully')
|
||||
@Response('401', 'Invalid or expired token')
|
||||
@Response('403', 'Not enrolled in this course')
|
||||
@Response('404', 'Lesson or quiz not found')
|
||||
public async getQuizAttempts(
|
||||
@Request() request: any,
|
||||
@Path() courseId: number,
|
||||
@Path() lessonId: number
|
||||
): Promise<GetQuizAttemptsResponse> {
|
||||
const token = request.headers.authorization?.replace('Bearer ', '');
|
||||
if (!token) {
|
||||
throw new ValidationError('No token provided');
|
||||
}
|
||||
return await this.service.getQuizAttempts({
|
||||
token,
|
||||
course_id: courseId,
|
||||
lesson_id: lessonId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue