feat: lecetureServiceImpl Refactoring

This commit is contained in:
박정민 2024-08-01 16:50:42 +09:00
parent 4f64d316d8
commit 48d08f0816
2 changed files with 12 additions and 14 deletions

View File

@ -224,19 +224,18 @@ public class LectureServiceImpl implements LectureService {
Optional<Lecture> lecture = lectureRepository.findById(id);
Lecture l;
if (lecture.isPresent()) {
l = lecture.get();
System.out.println(l.isOnline());
l.setOnline(true);
System.out.println(l.isOnline());
} else {
if (!lecture.isPresent()) {
throw new RuntimeException("Lecture not found with id: " + id);
}
Lecture l;
l = lecture.get();
l.setOnline(true);
lectureRepository.save(l);
}

View File

@ -57,10 +57,9 @@ public class UserController {
// 비밀번호 변경
@PutMapping("/updatepassword")
public ResponseEntity<String> updatePassword(
@RequestBody PasswordDto passwordDto, HttpServletRequest request) {
try {
public ResponseEntity<String> updatePassword(@RequestBody PasswordDto passwordDto, HttpServletRequest request) {
try
{
String token = request.getHeader("Authorization");
Long userId = Long.parseLong(jwtUtil.getUserId(token));