From 06e8acd0b25740253e52d585894060f45f117948 Mon Sep 17 00:00:00 2001 From: Sergey Yarkov Date: Tue, 7 Jun 2022 00:51:03 +0300 Subject: [PATCH] fix: lesson deleting --- app/Repositories/LessonRepository.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Repositories/LessonRepository.ts b/app/Repositories/LessonRepository.ts index a4c8688..4875996 100644 --- a/app/Repositories/LessonRepository.ts +++ b/app/Repositories/LessonRepository.ts @@ -202,7 +202,10 @@ export default class LessonRepository { /** * Delete files from disk */ - await this.Drive.delete(`videos/${lesson.video.name}`); + if (lesson.video) { + await this.Drive.delete(`videos/${lesson.video.name}`); + } + await this.deleteMaterials(lesson); /**