feat: add course approval history endpoint for instructors to view rejection reasons and approval timeline
This commit is contained in:
parent
11c747edab
commit
832a8f5067
3 changed files with 106 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ import {
|
|||
GetQuizScoresResponse,
|
||||
GetQuizAttemptDetailResponse,
|
||||
GetEnrolledStudentDetailResponse,
|
||||
GetCourseApprovalHistoryResponse,
|
||||
} from '../types/CoursesInstructor.types';
|
||||
import { CreateCourseValidator } from "../validators/CoursesInstructor.validator";
|
||||
|
||||
|
|
@ -398,4 +399,24 @@ export class CoursesInstructorController {
|
|||
student_id: studentId,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ดึงประวัติการขออนุมัติคอร์ส
|
||||
* Get course approval history for instructor to see rejection reasons
|
||||
* @param courseId - รหัสคอร์ส / Course ID
|
||||
*/
|
||||
@Get('{courseId}/approval-history')
|
||||
@Security('jwt', ['instructor'])
|
||||
@SuccessResponse('200', 'Approval history retrieved successfully')
|
||||
@Response('401', 'Invalid or expired token')
|
||||
@Response('403', 'Not an instructor of this course')
|
||||
@Response('404', 'Course not found')
|
||||
public async getCourseApprovalHistory(
|
||||
@Request() request: any,
|
||||
@Path() courseId: number
|
||||
): Promise<GetCourseApprovalHistoryResponse> {
|
||||
const token = request.headers.authorization?.replace('Bearer ', '');
|
||||
if (!token) throw new ValidationError('No token provided');
|
||||
return await CoursesInstructorService.getCourseApprovalHistory(token, courseId);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue