From 3de3c54140676a4fcefa0bf7bcceddb800a30836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9E=AC=ED=98=81?= Date: Sat, 28 Sep 2024 20:19:36 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20:recycle:=20=EC=B4=88=EB=8C=80?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=88=98=EC=A0=95=20(#40)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: :sparkles: 참여코드로 팀(방) 참여 기능 구현 (#27) * feat: :sparkles: 참여코드로 팀(방) 참여 기능 구현 * docs: 참여코드로 팀(방) 참여 api 문서 수정 * feat: ✨루틴 조회/추가/삭제 * feat: 루틴 생성 기능 수정 * fix: 루틴 조회 수정 * feat: :sparkles: 팀 생성 시, 팀 이름 설정 추가 (#32) * feat:✨ 팀 참가 인원 명단 조회 * feat:✨ 팀 참가 인원 명단 조회 * chore:정리 * feat:✨ 팀 루틴 목록 조회 * feat:✨ 팀 루틴 목록 조회 * feat:✨ 팀 루틴 목록 조회 * fix:✨ 팀 참가 유저 명단 조회 수정 * chore: 컬럼 애노테이션 정리 (#37) * refactor: :recycle: 초대코드 이메일 기능 수정 (#39) --------- Co-authored-by: gzhan0226 Co-authored-by: 한현규 <72931656+gzhan0226@users.noreply.github.com> --- .../com/goormdari/domain/team/application/TeamService.java | 6 ++---- .../goormdari/domain/team/presentation/TeamController.java | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/goormdari/domain/team/application/TeamService.java b/src/main/java/com/goormdari/domain/team/application/TeamService.java index ec3c1f5..1dbda4d 100644 --- a/src/main/java/com/goormdari/domain/team/application/TeamService.java +++ b/src/main/java/com/goormdari/domain/team/application/TeamService.java @@ -93,17 +93,15 @@ public CreateTeamResponse createNewTeam(final String username, final CreateTeamR } - public Message sendCode(String username, Long guestId) { + public Message sendCode(String username, String email) { User hostUser = userRepository.findByUsername(username) .orElseThrow(() -> new NotFoundException("User not found")); - User guestUser = userRepository.findById(guestId) - .orElseThrow(() -> new NotFoundException("Guest not found")); String joinCode = userRepository.findJoinCodeByUserId(hostUser.getId()); - emailClient.sendOneEmail(hostUser.getNickname(), guestUser.getEmail(), joinCode); + emailClient.sendOneEmail(hostUser.getNickname(), email, joinCode); return Message.builder() .message("이메일 전송에 성공했습니다.") diff --git a/src/main/java/com/goormdari/domain/team/presentation/TeamController.java b/src/main/java/com/goormdari/domain/team/presentation/TeamController.java index 2d042e9..7891355 100644 --- a/src/main/java/com/goormdari/domain/team/presentation/TeamController.java +++ b/src/main/java/com/goormdari/domain/team/presentation/TeamController.java @@ -56,17 +56,17 @@ public ResponseCustom createTeam( @ApiResponse(responseCode = "200", description = "팀(방) 참여코드 전달 성공", content = {@Content(mediaType = "application/json", schema = @Schema(implementation = Message.class))}), @ApiResponse(responseCode = "400", description = "팀(방) 참여코드 전달 실패", content = {@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class))}), }) - @PostMapping("/email/{guestId}") + @PostMapping("/email/{email}") public ResponseCustom sendJoinCode( @Parameter(description = "Accesstoken을 입력해주세요.", required = true) @RequestHeader("Authorization") String token, - @Parameter(description = "초대할 유저의 id를 입력해주세요.", required = true) @PathVariable Long guestId + @Parameter(description = "초대할 유저의 id를 입력해주세요.", required = true) @PathVariable String email ) { String jwt = token.startsWith("Bearer ") ? token.substring(7) : token; if (!jwtUtil.validateToken(jwt)) { throw new IllegalArgumentException("Invalid token"); } String username = jwtUtil.extractUsername(jwt); - return ResponseCustom.OK(teamService.sendCode(username, guestId)); + return ResponseCustom.OK(teamService.sendCode(username, email)); } @Operation(summary = "참여코드로 팀(방) 참여", description = "참여코드로 팀(방)에 참여합니다.")