From 8c48c0c8663abff6936a7b0341a8c43db9fa01d0 Mon Sep 17 00:00:00 2001 From: taking Date: Thu, 2 Nov 2023 06:19:19 +0000 Subject: [PATCH] Chore: InviteOrg Updated --- .../cherry/nw/controller/OrgController.java | 4 +-- .../cherry/nw/error/enums/SuccessCode.java | 2 +- .../cherry/nw/service/EmailAuthService.java | 3 +- .../nw/service/Impl/EmailAuthServiceImpl.java | 32 +------------------ .../nw/service/Impl/OrgServiceImpl.java | 4 +-- .../lab/cherry/nw/service/OrgService.java | 2 +- 6 files changed, 7 insertions(+), 40 deletions(-) diff --git a/nw/src/main/java/lab/cherry/nw/controller/OrgController.java b/nw/src/main/java/lab/cherry/nw/controller/OrgController.java index a5d23d0..e958900 100644 --- a/nw/src/main/java/lab/cherry/nw/controller/OrgController.java +++ b/nw/src/main/java/lab/cherry/nw/controller/OrgController.java @@ -178,14 +178,12 @@ public ResponseEntity deleteOrganization(@PathVariable("id") String id) { return new ResponseEntity<>(response, new HttpHeaders(), HttpStatus.OK); } - - @GetMapping("/invite") @Operation(summary = "사용자(랑부) 초대", description = "이메일로 조직 초대 메일을 발송합니다.") public ResponseEntity inviteUser(@RequestParam(required = false) String orgid, @RequestParam(required = false) String email) { log.info("[OrgController] inviteUser...!"); - orgService.inviteUser(orgid, email); + orgService.inviteOrgSend(orgid, email); final ResultResponse response = ResultResponse.of(SuccessCode.EMAIL_INVITE_USER_OK); return new ResponseEntity<>(response, new HttpHeaders(), HttpStatus.OK); } diff --git a/nw/src/main/java/lab/cherry/nw/error/enums/SuccessCode.java b/nw/src/main/java/lab/cherry/nw/error/enums/SuccessCode.java index d5a192f..8769c3f 100644 --- a/nw/src/main/java/lab/cherry/nw/error/enums/SuccessCode.java +++ b/nw/src/main/java/lab/cherry/nw/error/enums/SuccessCode.java @@ -22,7 +22,7 @@ public enum SuccessCode { FILE_UPLOAD_SUCCESS(200, "파일 업로드 완료"), REGISTER_SUCCESS(200, "회원가입 완료"), USERID_CHECK_OK(200, "사용 가능합니다."), - PASSWORD_RESET_OK(200, "비밀번호 초기화 이메일 발송 완료"), + PASSWORD_RESET_OK(200, "초기화 비밀번호 이메일 발송 완료"), EMAIL_INVITE_USER_OK(200, "사용자(랑부) 초대 이메일 발송 완료"), EMAIL_CHECK_OK(200, "이메일 인증 완료"), EMAIL_RESEND_OK(200, "이메일 인증 메일 재발송 완료"); diff --git a/nw/src/main/java/lab/cherry/nw/service/EmailAuthService.java b/nw/src/main/java/lab/cherry/nw/service/EmailAuthService.java index 6a43305..0982ff7 100644 --- a/nw/src/main/java/lab/cherry/nw/service/EmailAuthService.java +++ b/nw/src/main/java/lab/cherry/nw/service/EmailAuthService.java @@ -11,8 +11,7 @@ public interface EmailAuthService { EmailAuthEntity updateExpired(String email); Optional findValidAuthByEmail(String email, String token); void ConfirmEmailSend(String email, String token); - // void InviteOrgSend(String orgname, String email, String token); + void InviteOrgSend(String orgid, String orgname, String email); void ResetPasswordSend(String email, String password); - void InviteUserSend(String orgid, String orgname, String email); } \ No newline at end of file diff --git a/nw/src/main/java/lab/cherry/nw/service/Impl/EmailAuthServiceImpl.java b/nw/src/main/java/lab/cherry/nw/service/Impl/EmailAuthServiceImpl.java index f8b6002..d5d2e99 100644 --- a/nw/src/main/java/lab/cherry/nw/service/Impl/EmailAuthServiceImpl.java +++ b/nw/src/main/java/lab/cherry/nw/service/Impl/EmailAuthServiceImpl.java @@ -89,36 +89,6 @@ public void ConfirmEmailSend(String email, String token) { } - // public void InviteOrgSend(String orgname, String email, String token) { - - // MimeMessage message = javaMmailSender.createMimeMessage(); - // String _link = FRONTEND_ADDR + "/auth/register/confirm?email" + email + "&token=" + token; - // // "/api/auth/register/confirm?email" + email + "&token=" + token; - - // try { - // message.addRecipients(MimeMessage.RecipientType.TO, email); - // message.setFrom(EmailAuthServiceImpl.FROM_ADDRESS); - // message.setSubject("[낭만웨딩] " + orgname + " 회원가입 요청 메일입니다."); //제목 - // String text=""; - // text+= "
"; - // text+= "
"; - // text+= "

다음 링크를 눌러 회원가입을 진행하세요.

"; - // text+= "

회원이시라면 링크를 누르면 [" + orgname + "]에 소속됩니다.

"; - // text+= "
"; - // text+= "LINK : "; - // text+= "진행하기" + "

"; - // text+= "
"; - // message.setText(text, "utf-8", "html"); - - // javaMmailSender.send(message); - - - // } catch (MessagingException e) { - // log.error("email Error {}", e); - // } - // } - - public void ResetPasswordSend(String email, String password) { MimeMessage message = javaMmailSender.createMimeMessage(); @@ -146,7 +116,7 @@ public void ResetPasswordSend(String email, String password) { } - public void InviteUserSend(String orgid, String orgname, String email) { + public void InviteOrgSend(String orgid, String orgname, String email) { MimeMessage message = javaMmailSender.createMimeMessage(); String _link = FRONTEND_ADDR + "/auth/register/org/" + orgid; diff --git a/nw/src/main/java/lab/cherry/nw/service/Impl/OrgServiceImpl.java b/nw/src/main/java/lab/cherry/nw/service/Impl/OrgServiceImpl.java index 6bd008c..5b6debb 100644 --- a/nw/src/main/java/lab/cherry/nw/service/Impl/OrgServiceImpl.java +++ b/nw/src/main/java/lab/cherry/nw/service/Impl/OrgServiceImpl.java @@ -201,10 +201,10 @@ public Page findPageByName(String name, Pageable pageable) { return orgRepository.findPageByName(name, pageable); } - public void inviteUser(String orgid, String email) { + public void inviteOrgSend(String orgid, String email) { OrgEntity orgEntity = findById(orgid); - emailAuthService.InviteUserSend(orgid, orgEntity.getName(), email); + emailAuthService.InviteOrgSend(orgEntity.getId(), orgEntity.getName(), email); } } diff --git a/nw/src/main/java/lab/cherry/nw/service/OrgService.java b/nw/src/main/java/lab/cherry/nw/service/OrgService.java index dea0118..83fad53 100644 --- a/nw/src/main/java/lab/cherry/nw/service/OrgService.java +++ b/nw/src/main/java/lab/cherry/nw/service/OrgService.java @@ -22,5 +22,5 @@ public interface OrgService { OrgEntity findByName(String name); void deleteById(String id); Page findPageByName(String name, Pageable pageable); - void inviteUser(String orgid, String email); + void inviteOrgSend(String orgid, String email); }