refactor: add type assertions for request parameters and explicitly type multer middleware.

This commit is contained in:
JakkrapartXD 2026-01-20 10:03:06 +00:00
parent 04e2da43c4
commit cad3f276f5
2 changed files with 4 additions and 4 deletions

View file

@ -38,8 +38,8 @@ export class LessonsController {
throw new ValidationError('No token provided');
}
const courseId = parseInt(req.params.courseId, 10);
const chapterId = parseInt(req.params.chapterId, 10);
const courseId = parseInt(req.params.courseId as string, 10);
const chapterId = parseInt(req.params.chapterId as string, 10);
if (isNaN(courseId) || isNaN(chapterId)) {
throw new ValidationError('Invalid course ID or chapter ID');

View file

@ -1,5 +1,5 @@
import multer from 'multer';
import { Request } from 'express';
import { Request, RequestHandler } from 'express';
import { config } from '../config';
import { ValidationError } from './errorHandler';
@ -67,7 +67,7 @@ const fileFilter = (
* Multer configuration for lesson file uploads
* Stores files in memory for direct upload to MinIO
*/
export const lessonUpload = multer({
export const lessonUpload: RequestHandler = multer({
storage: multer.memoryStorage(),
limits: {
fileSize: config.upload.maxVideoSize, // Max file size (500MB for videos)