feat: qna 수정
This commit is contained in:
parent
25f7343b04
commit
1711fcaf95
@ -34,7 +34,7 @@ public class MailServiceImpl implements MailService {
|
||||
redisUtil.setDataExpire(code, email, 60 * 5L);
|
||||
|
||||
SimpleMailMessage mail = createEmail(email, "[EDUFOCUS] 비밀번호 찾기 안내", code);
|
||||
mailSender.send(mail);
|
||||
//mailSender.send(mail);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,6 +71,7 @@ public class QnaController {
|
||||
User findUser = userRepository.findById(userId).orElse(null);
|
||||
|
||||
if (findUser.getRole() != UserRole.ADMIN) {
|
||||
System.out.println("role 안맞음");
|
||||
throw new RuntimeException("update 실패");
|
||||
}
|
||||
|
||||
@ -88,6 +89,7 @@ public class QnaController {
|
||||
Long userId = Long.parseLong(jwtUtil.getUserId(token));
|
||||
User findUser = userRepository.findById(userId).orElse(null);
|
||||
|
||||
System.out.println("delete answer");
|
||||
if (findUser.getRole() != UserRole.ADMIN) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
@ -55,11 +55,13 @@ public class QnaServiceImpl implements QnaService {
|
||||
@Override
|
||||
public QnaResponseDto updateQna(Long id, QnaRequestDto qnaRequestDto, Long userId) {
|
||||
|
||||
System.out.println("userId:" + userId);
|
||||
|
||||
Qna qna = qnaRepository.findById(id).orElse(null);
|
||||
System.out.println("quesiton에 있는거: " + qna.getUser().getId());
|
||||
User user = userRepository.findById(userId).orElse(null);
|
||||
if (qna.getUser().getId() == userId) {
|
||||
qnaRepository.delete(qna);
|
||||
} else {
|
||||
|
||||
if (qna.getUser().getId() != userId) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user