feat: Add k6 video watching load test and remove optional comment body from admin course approval.
All checks were successful
Build and Deploy Backend / Build Backend Docker Image (push) Successful in 28s
Build and Deploy Backend / Deploy E-learning Backend to Dev Server (push) Successful in 3s
Build and Deploy Backend / Notify Deployment Status (push) Successful in 1s

This commit is contained in:
JakkrapartXD 2026-02-19 15:20:34 +07:00
parent 743d3b8c2f
commit c118e5c3dc
3 changed files with 271 additions and 15 deletions

View file

@ -1,11 +1,10 @@
import { Body, Get, Path, Post, Request, Response, Route, Security, SuccessResponse, Tags } from 'tsoa';
import { ValidationError } from '../middleware/errorHandler';
import { AdminCourseApprovalService } from '../services/AdminCourseApproval.service';
import { ApproveCourseValidator, RejectCourseValidator } from '../validators/AdminCourseApproval.validator';
import { RejectCourseValidator } from '../validators/AdminCourseApproval.validator';
import {
ListPendingCoursesResponse,
GetCourseDetailForAdminResponse,
ApproveCourseBody,
ApproveCourseResponse,
RejectCourseBody,
RejectCourseResponse,
@ -61,19 +60,12 @@ export class AdminCourseApprovalController {
@Response('404', 'Course not found')
public async approveCourse(
@Request() request: any,
@Path() courseId: number,
@Body() body?: ApproveCourseBody
@Path() courseId: number
): Promise<ApproveCourseResponse> {
const token = request.headers.authorization?.replace('Bearer ', '');
if (!token) throw new ValidationError('No token provided');
// Validate body if provided
if (body) {
const { error } = ApproveCourseValidator.validate(body);
if (error) throw new ValidationError(error.details[0].message);
}
return await AdminCourseApprovalService.approveCourse(token, courseId, body?.comment);
return await AdminCourseApprovalService.approveCourse(token, courseId, undefined);
}
/**