From 1711fcaf956b72d78aba25940101260c96c3aa84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A0=95=EB=AF=BC?= Date: Wed, 7 Aug 2024 17:44:27 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20qna=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edufocus/edufocus/mail/service/MailServiceImpl.java | 2 +- .../edufocus/edufocus/qna/controller/QnaController.java | 2 ++ .../com/edufocus/edufocus/qna/service/QnaServiceImpl.java | 8 +++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/mail/service/MailServiceImpl.java b/backend/src/main/java/com/edufocus/edufocus/mail/service/MailServiceImpl.java index 20859de..e6f02ac 100644 --- a/backend/src/main/java/com/edufocus/edufocus/mail/service/MailServiceImpl.java +++ b/backend/src/main/java/com/edufocus/edufocus/mail/service/MailServiceImpl.java @@ -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 diff --git a/backend/src/main/java/com/edufocus/edufocus/qna/controller/QnaController.java b/backend/src/main/java/com/edufocus/edufocus/qna/controller/QnaController.java index 64b2e73..c4c2a0a 100644 --- a/backend/src/main/java/com/edufocus/edufocus/qna/controller/QnaController.java +++ b/backend/src/main/java/com/edufocus/edufocus/qna/controller/QnaController.java @@ -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(); } diff --git a/backend/src/main/java/com/edufocus/edufocus/qna/service/QnaServiceImpl.java b/backend/src/main/java/com/edufocus/edufocus/qna/service/QnaServiceImpl.java index 637239c..3454e27 100644 --- a/backend/src/main/java/com/edufocus/edufocus/qna/service/QnaServiceImpl.java +++ b/backend/src/main/java/com/edufocus/edufocus/qna/service/QnaServiceImpl.java @@ -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(); }