Merge branch 'be/lecture' into 'backend'

feat: lecture 강의 삭제시 저장소에서 사진 삭제

See merge request s11-webmobile1-sub2/S11P12A701!164
This commit is contained in:
박정민 2024-08-12 09:50:07 +09:00
commit 852d0efc2e

View File

@ -113,6 +113,12 @@ public class LectureServiceImpl implements LectureService {
return false; return false;
} }
String image = lecture.getImage();
if (image != null) {
File file = new File(lecture.getImage());
file.delete();
}
lectureRepository.deleteById(lectureId); lectureRepository.deleteById(lectureId);
return true; return true;
} }
@ -220,9 +226,9 @@ public class LectureServiceImpl implements LectureService {
public int compare(LectureSearchResponse lsr1, LectureSearchResponse lsr2) { public int compare(LectureSearchResponse lsr1, LectureSearchResponse lsr2) {
long lsr1Id = lsr1.getId(); long lsr1Id = lsr1.getId();
long lsr2Id = lsr2.getId(); long lsr2Id = lsr2.getId();
if(lsr2Id > lsr1Id) if (lsr2Id > lsr1Id)
return 1; return 1;
else if(lsr2Id == lsr1Id) else if (lsr2Id == lsr1Id)
return 0; return 0;
return -1; return -1;
} }