refactor: update user identification to pass userId directly to services instead of JWT tokens.
Some checks failed
Build and Deploy Backend / Build Backend Docker Image (push) Successful in 48s
Build and Deploy Backend / Deploy E-learning Backend to Dev Server (push) Successful in 9s
Build and Deploy Backend / Notify Deployment Status (push) Successful in 2s
Build and Deploy Frontend Learner / Build Frontend Learner Docker Image (push) Failing after 33s
Build and Deploy Frontend Learner / Deploy E-learning Frontend Learner to Dev Server (push) Has been skipped
Build and Deploy Frontend Learner / Notify Deployment Status (push) Failing after 1s
Some checks failed
Build and Deploy Backend / Build Backend Docker Image (push) Successful in 48s
Build and Deploy Backend / Deploy E-learning Backend to Dev Server (push) Successful in 9s
Build and Deploy Backend / Notify Deployment Status (push) Successful in 2s
Build and Deploy Frontend Learner / Build Frontend Learner Docker Image (push) Failing after 33s
Build and Deploy Frontend Learner / Deploy E-learning Frontend Learner to Dev Server (push) Has been skipped
Build and Deploy Frontend Learner / Notify Deployment Status (push) Failing after 1s
This commit is contained in:
parent
b6c1aebe30
commit
522a0eec8a
28 changed files with 558 additions and 952 deletions
|
|
@ -42,8 +42,6 @@ export class LessonsController {
|
|||
@Path() lessonId: number,
|
||||
@UploadedFile() video: Express.Multer.File
|
||||
): Promise<VideoOperationResponse> {
|
||||
const token = request.headers.authorization?.replace('Bearer ', '');
|
||||
if (!token) throw new ValidationError('No token provided');
|
||||
|
||||
if (!video) {
|
||||
throw new ValidationError('Video file is required');
|
||||
|
|
@ -57,7 +55,7 @@ export class LessonsController {
|
|||
};
|
||||
|
||||
return await chaptersLessonService.uploadVideo({
|
||||
token,
|
||||
userId: request.user.id,
|
||||
course_id: courseId,
|
||||
lesson_id: lessonId,
|
||||
video: videoInfo,
|
||||
|
|
@ -87,8 +85,6 @@ export class LessonsController {
|
|||
@Path() lessonId: number,
|
||||
@UploadedFile() video: Express.Multer.File
|
||||
): Promise<VideoOperationResponse> {
|
||||
const token = request.headers.authorization?.replace('Bearer ', '');
|
||||
if (!token) throw new ValidationError('No token provided');
|
||||
|
||||
if (!video) {
|
||||
throw new ValidationError('Video file is required');
|
||||
|
|
@ -102,7 +98,7 @@ export class LessonsController {
|
|||
};
|
||||
|
||||
return await chaptersLessonService.updateVideo({
|
||||
token,
|
||||
userId: request.user.id,
|
||||
course_id: courseId,
|
||||
lesson_id: lessonId,
|
||||
video: videoInfo,
|
||||
|
|
@ -132,8 +128,6 @@ export class LessonsController {
|
|||
@Path() lessonId: number,
|
||||
@UploadedFile() attachment: Express.Multer.File
|
||||
): Promise<AttachmentOperationResponse> {
|
||||
const token = request.headers.authorization?.replace('Bearer ', '');
|
||||
if (!token) throw new ValidationError('No token provided');
|
||||
|
||||
if (!attachment) {
|
||||
throw new ValidationError('Attachment file is required');
|
||||
|
|
@ -147,7 +141,7 @@ export class LessonsController {
|
|||
};
|
||||
|
||||
return await chaptersLessonService.uploadAttachment({
|
||||
token,
|
||||
userId: request.user.id,
|
||||
course_id: courseId,
|
||||
lesson_id: lessonId,
|
||||
attachment: attachmentInfo,
|
||||
|
|
@ -177,11 +171,9 @@ export class LessonsController {
|
|||
@Path() lessonId: number,
|
||||
@Path() attachmentId: number
|
||||
): Promise<DeleteAttachmentResponse> {
|
||||
const token = request.headers.authorization?.replace('Bearer ', '');
|
||||
if (!token) throw new ValidationError('No token provided');
|
||||
|
||||
return await chaptersLessonService.deleteAttachment({
|
||||
token,
|
||||
userId: request.user.id,
|
||||
course_id: courseId,
|
||||
lesson_id: lessonId,
|
||||
attachment_id: attachmentId,
|
||||
|
|
@ -211,14 +203,12 @@ export class LessonsController {
|
|||
@Path() lessonId: number,
|
||||
@Body() body: SetYouTubeVideoBody
|
||||
): Promise<YouTubeVideoResponse> {
|
||||
const token = request.headers.authorization?.replace('Bearer ', '');
|
||||
if (!token) throw new ValidationError('No token provided');
|
||||
|
||||
const { error } = SetYouTubeVideoValidator.validate(body);
|
||||
if (error) throw new ValidationError(error.details[0].message);
|
||||
|
||||
return await chaptersLessonService.setYouTubeVideo({
|
||||
token,
|
||||
userId: request.user.id,
|
||||
course_id: courseId,
|
||||
lesson_id: lessonId,
|
||||
youtube_video_id: body.youtube_video_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue