feat: add course approval history endpoint for instructors to view rejection reasons and approval timeline

This commit is contained in:
JakkrapartXD 2026-02-06 14:52:10 +07:00
parent 11c747edab
commit 832a8f5067
3 changed files with 106 additions and 0 deletions

View file

@ -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);
}
}