refactor: add type assertions for request parameters and explicitly type multer middleware.
This commit is contained in:
parent
04e2da43c4
commit
cad3f276f5
2 changed files with 4 additions and 4 deletions
|
|
@ -38,8 +38,8 @@ export class LessonsController {
|
||||||
throw new ValidationError('No token provided');
|
throw new ValidationError('No token provided');
|
||||||
}
|
}
|
||||||
|
|
||||||
const courseId = parseInt(req.params.courseId, 10);
|
const courseId = parseInt(req.params.courseId as string, 10);
|
||||||
const chapterId = parseInt(req.params.chapterId, 10);
|
const chapterId = parseInt(req.params.chapterId as string, 10);
|
||||||
|
|
||||||
if (isNaN(courseId) || isNaN(chapterId)) {
|
if (isNaN(courseId) || isNaN(chapterId)) {
|
||||||
throw new ValidationError('Invalid course ID or chapter ID');
|
throw new ValidationError('Invalid course ID or chapter ID');
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import multer from 'multer';
|
import multer from 'multer';
|
||||||
import { Request } from 'express';
|
import { Request, RequestHandler } from 'express';
|
||||||
import { config } from '../config';
|
import { config } from '../config';
|
||||||
import { ValidationError } from './errorHandler';
|
import { ValidationError } from './errorHandler';
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ const fileFilter = (
|
||||||
* Multer configuration for lesson file uploads
|
* Multer configuration for lesson file uploads
|
||||||
* Stores files in memory for direct upload to MinIO
|
* Stores files in memory for direct upload to MinIO
|
||||||
*/
|
*/
|
||||||
export const lessonUpload = multer({
|
export const lessonUpload: RequestHandler = multer({
|
||||||
storage: multer.memoryStorage(),
|
storage: multer.memoryStorage(),
|
||||||
limits: {
|
limits: {
|
||||||
fileSize: config.upload.maxVideoSize, // Max file size (500MB for videos)
|
fileSize: config.upload.maxVideoSize, // Max file size (500MB for videos)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue