make admin approve api

This commit is contained in:
JakkrapartXD 2026-01-23 13:16:41 +07:00
parent 6acb536aef
commit 5d6cab229f
7 changed files with 616 additions and 1 deletions

View file

@ -16,7 +16,8 @@ import {
UpdateMyCourseResponse,
DeleteMyCourseResponse,
submitCourseResponse,
listinstructorCourseResponse
listinstructorCourseResponse,
GetCourseApprovalsResponse
} from '../types/CoursesInstructor.types';
import { CreateCourseValidator } from "../validators/CoursesInstructor.validator";
@ -134,6 +135,25 @@ export class CoursesInstructorController {
return await CoursesInstructorService.sendCourseForReview({ token, course_id: courseId });
}
/**
*
* Get all course approval history
* @param courseId - / Course ID
*/
@Get('{courseId}/approvals')
@Security('jwt', ['instructor'])
@SuccessResponse('200', 'Course approvals retrieved successfully')
@Response('401', 'Invalid or expired token')
@Response('403', 'You are not an instructor of this course')
@Response('404', 'Course not found')
public async getCourseApprovals(@Request() request: any, @Path() courseId: number): Promise<GetCourseApprovalsResponse> {
const token = request.headers.authorization?.replace('Bearer ', '');
if (!token) {
throw new ValidationError('No token provided');
}
return await CoursesInstructorService.getCourseApprovals(token, courseId);
}
/**
*
* Get list of all instructors in a specific course