refactor: simplify instructor search to query all instructors without course-specific filtering
This commit is contained in:
parent
f4a12c686b
commit
0641b2547a
3 changed files with 12 additions and 29 deletions
|
|
@ -198,19 +198,18 @@ export class CoursesInstructorController {
|
|||
}
|
||||
|
||||
/**
|
||||
* ค้นหาผู้สอนสำหรับเพิ่มเข้าคอร์ส
|
||||
* Search instructors to add to course
|
||||
* @param courseId - รหัสคอร์ส / Course ID
|
||||
* ค้นหาผู้สอนทั้งหมดในระบบ
|
||||
* Search all instructors in database
|
||||
* @param query - คำค้นหา (email หรือ username) / Search query (email or username)
|
||||
*/
|
||||
@Get('{courseId}/search-instructors')
|
||||
@Get('search-instructors')
|
||||
@Security('jwt', ['instructor'])
|
||||
@SuccessResponse('200', 'Instructors found')
|
||||
@Response('401', 'Invalid or expired token')
|
||||
public async searchInstructors(@Request() request: any, @Path() courseId: number, @Query() query: string): Promise<SearchInstructorResponse> {
|
||||
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, course_id: courseId, query });
|
||||
return await CoursesInstructorService.searchInstructors({ token, query });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue