refactor: reorder searchInstructors endpoint and fix role code to uppercase INSTRUCTOR, add lesson completion tracking on quiz pass

This commit is contained in:
JakkrapartXD 2026-01-29 16:39:33 +07:00
parent 8e57cb124a
commit 24c37df4ef
3 changed files with 39 additions and 17 deletions

View file

@ -43,6 +43,21 @@ export class CoursesInstructorController {
return await CoursesInstructorService.listMyCourses(token);
}
/**
*
* Search all instructors in database
* @param query - (email username) / Search query (email or username)
*/
@Get('search-instructors')
@Security('jwt', ['instructor'])
@SuccessResponse('200', 'Instructors found')
@Response('401', 'Invalid or expired token')
public async searchInstructors(@Request() request: any, @Query() query: string): Promise<SearchInstructorResponse> {
const token = request.headers.authorization?.replace('Bearer ', '');
if (!token) throw new ValidationError('No token provided');
return await CoursesInstructorService.searchInstructors({ token, query });
}
/**
* ()
* Get detailed course information including chapters, lessons, attachments, and quizzes
@ -197,21 +212,6 @@ export class CoursesInstructorController {
return await CoursesInstructorService.listInstructorsOfCourse({ token, course_id: courseId });
}
/**
*
* Search all instructors in database
* @param query - (email username) / Search query (email or username)
*/
@Get('search-instructors')
@Security('jwt', ['instructor'])
@SuccessResponse('200', 'Instructors found')
@Response('401', 'Invalid or expired token')
public async searchInstructors(@Request() request: any, @Query() query: string): Promise<SearchInstructorResponse> {
const token = request.headers.authorization?.replace('Bearer ', '');
if (!token) throw new ValidationError('No token provided');
return await CoursesInstructorService.searchInstructors({ token, query });
}
/**
* ( email username)
* Add a new instructor to the course (using email or username)