From d20f97b04ff60650c1a3d11b77cd72e97349da40 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Wed, 10 Jan 2024 21:15:28 +0900 Subject: [PATCH 01/13] =?UTF-8?q?[refactor/72-task]=20=EC=A3=BC=EC=84=9D?= =?UTF-8?q?=EC=A7=80=EC=9A=B0=EA=B8=B0=20=EB=B0=8F=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=A6=AC=ED=8E=99=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/application/AuthService.java | 6 ++--- .../CustomDefaultOAuth2UserService.java | 19 ++----------- .../domain/user/application/UserService.java | 6 ++--- .../ideac/domain/user/domain/Provider.java | 7 +---- ...SimpleUrlAuthenticationSuccessHandler.java | 2 +- .../auth/presentation/AuthController.java | 5 ---- .../ideac/domain/auth/presentation/test.java | 27 ------------------- 7 files changed, 9 insertions(+), 63 deletions(-) delete mode 100644 ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/test.java diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java index 6b0894d..b79f839 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java @@ -38,10 +38,6 @@ public class AuthService { // 회원가입 하기 public ResponseEntity signUp(SignUpReq signUpRequest){ -// //검증 -// DefaultAssert.isTrue(!userRepository.existsByEmail(signUpRequest.getIdEmail()), "해당 이메일이 존재합니다."); -// DefaultAssert.isTrue(!userRepository.existsByNickname(signUpRequest.getNickname()), "이미 존재하는 닉네임입니다."); - User user = User.builder() .email(signUpRequest.getIdEmail()) .password(passwordEncoder.encode(signUpRequest.getPassword())) @@ -164,6 +160,7 @@ private boolean valid(String refreshToken){ return true; } + // 닉네임 중복검증 public ResponseEntity doubleCheckNickname(String nickname) { ApiResponse apiResponse = ApiResponse.builder() .check(true) @@ -173,6 +170,7 @@ public ResponseEntity doubleCheckNickname(String nickname) { return ResponseEntity.ok(apiResponse); } + // 이메일 중복검증 public ResponseEntity doubleCheckEmail(String email) { ApiResponse apiResponse = ApiResponse.builder() .check(true) diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/CustomDefaultOAuth2UserService.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/CustomDefaultOAuth2UserService.java index 9afcc59..295ea85 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/CustomDefaultOAuth2UserService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/CustomDefaultOAuth2UserService.java @@ -43,19 +43,12 @@ private OAuth2User processOAuth2User(OAuth2UserRequest oAuth2UserRequest, OAuth2 Optional userOptional = userRepository.findByEmail(oAuth2UserInfo.getEmail()); User user; - if(userOptional.isPresent()) { - user = userOptional.get(); - DefaultAssert.isAuthentication(user.getProvider().equals(Provider.valueOf(oAuth2UserRequest.getClientRegistration().getRegistrationId()))); -// user = updateExistingUser(user, oAuth2UserInfo); - } else { - user = registerNewUser(oAuth2UserRequest, oAuth2UserInfo); - log.info("통과1"); - - } + user = registerNewUser(oAuth2UserRequest, oAuth2UserInfo); return UserPrincipal.create(user, oAuth2User.getAttributes()); } + // oauth2 회원 등록 private User registerNewUser(OAuth2UserRequest oAuth2UserRequest, OAuth2UserInfo oAuth2UserInfo) { User user = User.builder() .provider(Provider.valueOf(oAuth2UserRequest.getClientRegistration().getRegistrationId())) @@ -67,12 +60,4 @@ private User registerNewUser(OAuth2UserRequest oAuth2UserRequest, OAuth2UserInfo .build(); return userRepository.save(user); } - -// private User updateExistingUser(User user, OAuth2UserInfo oAuth2UserInfo) { -//// 추후 사용시 바뀔예정인 함수 -//// user.updateName(oAuth2UserInfo.getName()); -//// user.updateImageUrl(oAuth2UserInfo.getImageUrl()); -// -// return userRepository.save(user); -// } } diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java b/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java index 7275c23..eeba6c6 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java @@ -42,7 +42,7 @@ public ResponseEntity changePassword(@Valid PasswordReq passwordReq, String c Verify verify = mailRepository.findByCode(code); if (verify == null){ - throw new DefaultException(ErrorCode.INVALID_CHECK, "이미변경되었습니다?"); + throw new DefaultException(ErrorCode.INVALID_CHECK, "이미변경되었습니다."); } DefaultAssert.isTrue(verify.checkExpiration(LocalDateTime.now()), "만료되었습니다."); @@ -58,7 +58,7 @@ public ResponseEntity changePassword(@Valid PasswordReq passwordReq, String c ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(null) - .message("비밀번호를 바꾸었어요") + .message("비밀번호를 바꾸었습니다.") .build(); return ResponseEntity.ok(apiResponse); @@ -86,7 +86,7 @@ public ResponseEntity deleteUser(UserPrincipal userPrincipal) { ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(null) - .message("회원탈퇴 완료!") + .message("회원탈퇴 완료하였습니다.") .build(); return ResponseEntity.ok(apiResponse); diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/Provider.java b/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/Provider.java index e244ef4..821432b 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/Provider.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/Provider.java @@ -1,10 +1,5 @@ package depth.main.ideac.domain.user.domain; public enum Provider { - local, - facebook, - google, - github, - kakao, - naver + google } diff --git a/ideac-core/src/main/java/depth/main/ideac/global/config/security/handler/CustomSimpleUrlAuthenticationSuccessHandler.java b/ideac-core/src/main/java/depth/main/ideac/global/config/security/handler/CustomSimpleUrlAuthenticationSuccessHandler.java index 6e60e91..3176e4b 100644 --- a/ideac-core/src/main/java/depth/main/ideac/global/config/security/handler/CustomSimpleUrlAuthenticationSuccessHandler.java +++ b/ideac-core/src/main/java/depth/main/ideac/global/config/security/handler/CustomSimpleUrlAuthenticationSuccessHandler.java @@ -55,7 +55,7 @@ protected String determineTargetUrl(HttpServletRequest request, HttpServletRespo DefaultAssert.isAuthentication( !(redirectUri.isPresent() && !isAuthorizedRedirectUri(redirectUri.get())) ); // String targetUrl = redirectUri.orElse(getDefaultTargetUrl()); // - String targetUrl = redirectUri.orElse("/auth/sign-up"); //회원가입창으로 리다이렉트 + String targetUrl = redirectUri.orElse("/api/user/google"); //회원가입창으로 리다이렉트 log.info(targetUrl); System.out.println("targetUrl = " + targetUrl); TokenMapping tokenMapping = customTokenProviderService.createToken(authentication); diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java b/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java index 3134265..9d9e85e 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java @@ -83,10 +83,5 @@ public ResponseEntity doubleCheckEmail(@PathVariable(value = "email") String return authService.doubleCheckEmail(email); } -// @GetMapping(value = "test") -// public ResponseEntity test(){ -// -// return ResponseEntity.ok("test"); -// } } diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/test.java b/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/test.java deleted file mode 100644 index 7bd2146..0000000 --- a/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/test.java +++ /dev/null @@ -1,27 +0,0 @@ -package depth.main.ideac.domain.auth.presentation; -import io.swagger.v3.oas.annotations.Hidden; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -@RestController -@RequestMapping("/") -public class test { - @GetMapping("/returnStr") - public String returnStr(@RequestParam String str) { - return str + "\n" + str; - } - - @GetMapping("/example") - public String example() { - return "예시 API"; - } - - @GetMapping("/ignore") - public String ignore() { - return "무시되는 API"; - } -} From 68c149e56fc91be1b19a955f07107f04c51f6d28 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Wed, 10 Jan 2024 21:46:46 +0900 Subject: [PATCH 02/13] =?UTF-8?q?[refactor/72-task]=20=EC=A3=BC=EC=84=9D?= =?UTF-8?q?=EC=A7=80=EC=9A=B0=EA=B8=B0=20=EB=B0=8F=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=A6=AC=ED=8E=99=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [refactor/72-task] 주석지우기 및 코드 리펙토링 --- .../main/ideac/domain/idea_post/IdeaPost.java | 8 -------- .../idea_post/application/IdeaPostService.java | 16 ++++++++++------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/idea_post/IdeaPost.java b/ideac-core/src/main/java/depth/main/ideac/domain/idea_post/IdeaPost.java index 7798fe3..741c9cb 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/idea_post/IdeaPost.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/idea_post/IdeaPost.java @@ -42,12 +42,4 @@ public class IdeaPost extends BaseEntity { private User user; private Long hits; - -// public void updateIdea(UpdateIdeaReq updateIdeaReq) { -// this.title = updateIdeaReq.getTitle(); -// this.simpleDescription = updateIdeaReq.getSimpleDescription(); -// this.detailedDescription = updateIdeaReq.getDetailedDescription(); -// this.url1 = updateIdeaReq.getUrl1(); -// this.url2 = updateIdeaReq.getUrl2(); -// } } diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java index 390ec90..c0a2535 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java @@ -37,6 +37,7 @@ public class IdeaPostService { private final UserRepository userRepository; private final RedisTemplate redisTemplate; + //아이디어 등록 @Transactional public Long registerIdea(UserPrincipal userPrincipal, RegisterIdeaReq registerIdeaReq){ User user = userRepository.findById(userPrincipal.getId()).get(); @@ -56,6 +57,7 @@ public Long registerIdea(UserPrincipal userPrincipal, RegisterIdeaReq registerId return ideapost.getId(); } + //상세아디이어 조회 @Transactional public ResponseEntity getDetailIdea(Long id) { IdeaPost ideaPost = ideaPostRepository.findById(id).get(); @@ -75,11 +77,12 @@ public ResponseEntity getDetailIdea(Long id) { ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(getDetailIdeaRes) - .message("상세내용을 가져왔어요!") + .message("상세내용을 가져왔습니다.") .build(); return ResponseEntity.ok(apiResponse); } + //아이디어 수정 @Transactional public ResponseEntity updateIdea(Long id, UpdateIdeaReq updateIdeaReq) { IdeaPost ideaPost = ideaPostRepository.findById(id).get(); @@ -94,11 +97,12 @@ public ResponseEntity updateIdea(Long id, UpdateIdeaReq updateIdeaReq) { ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(null) - .message("업데이트 했어요!") + .message("아이디어가 업데이트 되었습니다.!") .build(); return ResponseEntity.ok(apiResponse); } + //아이디어 삭제 @Transactional public ResponseEntity deleteIdea(Long id) { IdeaPost ideaPost = ideaPostRepository.findById(id).get(); @@ -106,11 +110,12 @@ public ResponseEntity deleteIdea(Long id) { ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(null) - .message("삭제 했어요!") + .message("아이디어가 삭제되었습니다.") .build(); return ResponseEntity.ok(apiResponse); } + //모든 아이디어들 조회 public ResponseEntity getAllIdea(int page, int size, String sortBy) { Pageable pageable; if (sortBy.equals("hits")) { @@ -131,11 +136,12 @@ public ResponseEntity getAllIdea(int page, int size, String sortBy) { ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(getAllIdeasRes) - .message("조회목록들이에요") + .message("조회목록들입니다.") .build(); return ResponseEntity.ok(apiResponse); } + //권한 검증 public boolean isAdminOrWriter(Long ideaId, Long userId) { User user = userRepository.findById(userId) .orElseThrow(() -> new DefaultException(ErrorCode.INVALID_PARAMETER)); @@ -150,7 +156,6 @@ public boolean isAdminOrWriter(Long ideaId, Long userId) { } @Transactional - //@Cacheable(value = "Contents", key = "#contentId", cacheManager = "contentCacheManager") public void addHitToRedis(Long id) { String key = "ideaPostHitCnt::" + id; ValueOperations valueOperations = redisTemplate.opsForValue(); @@ -177,6 +182,5 @@ public void deleteHitFromRedis() { redisTemplate.delete(data); } - System.out.println("ideaPost hits update complete"); } } From 9e1f5a10355fecd8621c48ef85cb83228f0fe446 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Wed, 10 Jan 2024 22:38:09 +0900 Subject: [PATCH 03/13] =?UTF-8?q?[refactor/72-task]=20dto=20req=20res=20?= =?UTF-8?q?=EA=B5=AC=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [refactor/72-task] dto req res 구분 --- .../ideac/domain/auth/presentation/AuthController.java | 10 +++------- .../ideac/domain/auth/application/AuthService.java | 5 +++++ .../ideac/domain/auth/dto/{ => req}/FindIdReq.java | 2 +- .../domain/auth/dto/{ => req}/RefreshTokenReq.java | 2 +- .../ideac/domain/auth/dto/{ => req}/SignInReq.java | 2 +- .../ideac/domain/auth/dto/{ => req}/SignUpReq.java | 2 +- .../main/ideac/domain/auth/dto/{ => res}/AuthRes.java | 2 +- .../ideac/domain/user/application/UserService.java | 3 +-- .../java/depth/main/ideac/domain/user/domain/User.java | 2 +- .../ideac/domain/auth/presentation/AuthController.java | 8 ++++---- .../ideac/domain/home/application/HomeService.java | 2 +- .../ideac/domain/home/presentation/HomeController.java | 2 +- .../domain/idea_post/application/IdeaPostService.java | 5 ++++- .../idea_post/dto/{ => req}/RegisterIdeaReq.java | 2 +- .../domain/idea_post/dto/{ => req}/UpdateIdeaReq.java | 2 +- .../domain/idea_post/dto/{ => res}/GetAllIdeasRes.java | 2 +- .../idea_post/dto/{ => res}/GetDetailIdeaRes.java | 2 +- .../idea_post/presentation/IdeaPostController.java | 4 ++-- .../ideac/domain/user/presentation/UserController.java | 3 +-- 19 files changed, 32 insertions(+), 30 deletions(-) rename ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/{ => req}/FindIdReq.java (92%) rename ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/{ => req}/RefreshTokenReq.java (93%) rename ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/{ => req}/SignInReq.java (94%) rename ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/{ => req}/SignUpReq.java (97%) rename ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/{ => res}/AuthRes.java (95%) rename ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/{ => req}/RegisterIdeaReq.java (93%) rename ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/{ => req}/UpdateIdeaReq.java (93%) rename ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/{ => res}/GetAllIdeasRes.java (88%) rename ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/{ => res}/GetDetailIdeaRes.java (87%) diff --git a/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java b/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java index 421863a..9e29a5b 100644 --- a/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java +++ b/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java @@ -3,12 +3,9 @@ import depth.main.ideac.domain.admin.application.AdminService; import depth.main.ideac.domain.auth.application.AuthService; -import depth.main.ideac.domain.auth.dto.AuthRes; -import depth.main.ideac.domain.auth.dto.FindIdReq; -import depth.main.ideac.domain.auth.dto.SignInReq; -import depth.main.ideac.domain.auth.dto.SignUpReq; -import depth.main.ideac.domain.user.application.UserService; -import depth.main.ideac.domain.user.domain.User; +import depth.main.ideac.domain.auth.dto.res.AuthRes; +import depth.main.ideac.domain.auth.dto.req.FindIdReq; +import depth.main.ideac.domain.auth.dto.req.SignInReq; import depth.main.ideac.global.payload.ErrorResponse; import depth.main.ideac.global.payload.Message; import io.swagger.v3.oas.annotations.Operation; @@ -22,7 +19,6 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.security.access.AccessDeniedException; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @Tag(name = "Auth API", description = "Authorization 관련 API입니다.") diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java index b79f839..b5069ac 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java @@ -3,6 +3,11 @@ import depth.main.ideac.domain.auth.domain.Token; import depth.main.ideac.domain.auth.domain.repository.TokenRepository; import depth.main.ideac.domain.auth.dto.*; +import depth.main.ideac.domain.auth.dto.req.FindIdReq; +import depth.main.ideac.domain.auth.dto.req.RefreshTokenReq; +import depth.main.ideac.domain.auth.dto.req.SignInReq; +import depth.main.ideac.domain.auth.dto.req.SignUpReq; +import depth.main.ideac.domain.auth.dto.res.AuthRes; import depth.main.ideac.domain.user.domain.Role; import depth.main.ideac.domain.user.domain.Status; import depth.main.ideac.domain.user.domain.User; diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/FindIdReq.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/FindIdReq.java similarity index 92% rename from ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/FindIdReq.java rename to ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/FindIdReq.java index 8e4e91f..8f418a2 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/FindIdReq.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/FindIdReq.java @@ -1,4 +1,4 @@ -package depth.main.ideac.domain.auth.dto; +package depth.main.ideac.domain.auth.dto.req; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/RefreshTokenReq.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/RefreshTokenReq.java similarity index 93% rename from ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/RefreshTokenReq.java rename to ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/RefreshTokenReq.java index 306b965..1adf3e2 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/RefreshTokenReq.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/RefreshTokenReq.java @@ -1,4 +1,4 @@ -package depth.main.ideac.domain.auth.dto; +package depth.main.ideac.domain.auth.dto.req; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/SignInReq.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignInReq.java similarity index 94% rename from ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/SignInReq.java rename to ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignInReq.java index a9da48f..279032e 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/SignInReq.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignInReq.java @@ -1,4 +1,4 @@ -package depth.main.ideac.domain.auth.dto; +package depth.main.ideac.domain.auth.dto.req; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Email; diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/SignUpReq.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignUpReq.java similarity index 97% rename from ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/SignUpReq.java rename to ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignUpReq.java index ae6201f..ffe4c3d 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/SignUpReq.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignUpReq.java @@ -1,4 +1,4 @@ -package depth.main.ideac.domain.auth.dto; +package depth.main.ideac.domain.auth.dto.req; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Email; diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/AuthRes.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/res/AuthRes.java similarity index 95% rename from ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/AuthRes.java rename to ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/res/AuthRes.java index bf005d0..d3beba1 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/AuthRes.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/res/AuthRes.java @@ -1,4 +1,4 @@ -package depth.main.ideac.domain.auth.dto; +package depth.main.ideac.domain.auth.dto.res; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java b/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java index eeba6c6..00de936 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java @@ -2,10 +2,9 @@ import depth.main.ideac.domain.auth.domain.Token; import depth.main.ideac.domain.auth.domain.repository.TokenRepository; -import depth.main.ideac.domain.auth.dto.SignUpReq; +import depth.main.ideac.domain.auth.dto.req.SignUpReq; import depth.main.ideac.domain.mail.domain.Verify; import depth.main.ideac.domain.mail.domain.repository.MailRepository; -import depth.main.ideac.domain.user.domain.Role; import depth.main.ideac.domain.user.domain.Status; import depth.main.ideac.domain.user.domain.User; import depth.main.ideac.domain.user.domain.repository.UserRepository; diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/User.java b/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/User.java index 27aed4a..effaea5 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/User.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/User.java @@ -1,6 +1,6 @@ package depth.main.ideac.domain.user.domain; -import depth.main.ideac.domain.auth.dto.SignUpReq; +import depth.main.ideac.domain.auth.dto.req.SignUpReq; import depth.main.ideac.domain.club_post.ClubPost; import depth.main.ideac.domain.common.BaseEntity; import depth.main.ideac.domain.idea_post.IdeaPost; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java b/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java index 9d9e85e..d98e2f7 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java @@ -2,10 +2,10 @@ import depth.main.ideac.domain.auth.application.AuthService; -import depth.main.ideac.domain.auth.dto.AuthRes; -import depth.main.ideac.domain.auth.dto.FindIdReq; -import depth.main.ideac.domain.auth.dto.SignInReq; -import depth.main.ideac.domain.auth.dto.SignUpReq; +import depth.main.ideac.domain.auth.dto.res.AuthRes; +import depth.main.ideac.domain.auth.dto.req.FindIdReq; +import depth.main.ideac.domain.auth.dto.req.SignInReq; +import depth.main.ideac.domain.auth.dto.req.SignUpReq; import depth.main.ideac.global.payload.ErrorResponse; import depth.main.ideac.global.payload.Message; import io.swagger.v3.oas.annotations.Operation; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/home/application/HomeService.java b/ideac-user/src/main/java/depth/main/ideac/domain/home/application/HomeService.java index 0cf9bf6..3f0aa36 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/home/application/HomeService.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/home/application/HomeService.java @@ -5,7 +5,7 @@ import depth.main.ideac.domain.club_post.dto.ClubPostRes; import depth.main.ideac.domain.club_post.repository.ClubPostRepository; import depth.main.ideac.domain.idea_post.IdeaPost; -import depth.main.ideac.domain.idea_post.dto.GetAllIdeasRes; +import depth.main.ideac.domain.idea_post.dto.res.GetAllIdeasRes; import depth.main.ideac.domain.idea_post.repository.IdeaPostRepository; import depth.main.ideac.domain.project_post.ProjectPost; import depth.main.ideac.domain.project_post.ProjectPostImage; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/home/presentation/HomeController.java b/ideac-user/src/main/java/depth/main/ideac/domain/home/presentation/HomeController.java index dd27c7e..4c02fc8 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/home/presentation/HomeController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/home/presentation/HomeController.java @@ -2,7 +2,7 @@ import depth.main.ideac.domain.club_post.dto.ClubPostRes; import depth.main.ideac.domain.home.application.HomeService; -import depth.main.ideac.domain.idea_post.dto.GetAllIdeasRes; +import depth.main.ideac.domain.idea_post.dto.res.GetAllIdeasRes; import depth.main.ideac.domain.project_post.dto.response.ProjectRes; import depth.main.ideac.global.payload.ApiResponse; import io.swagger.v3.oas.annotations.Operation; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java index c0a2535..7c0b954 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java @@ -1,7 +1,10 @@ package depth.main.ideac.domain.idea_post.application; import depth.main.ideac.domain.idea_post.IdeaPost; -import depth.main.ideac.domain.idea_post.dto.*; +import depth.main.ideac.domain.idea_post.dto.req.RegisterIdeaReq; +import depth.main.ideac.domain.idea_post.dto.req.UpdateIdeaReq; +import depth.main.ideac.domain.idea_post.dto.res.GetAllIdeasRes; +import depth.main.ideac.domain.idea_post.dto.res.GetDetailIdeaRes; import depth.main.ideac.domain.idea_post.repository.IdeaPostRepository; import depth.main.ideac.domain.user.domain.Role; import depth.main.ideac.domain.user.domain.User; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/RegisterIdeaReq.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/req/RegisterIdeaReq.java similarity index 93% rename from ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/RegisterIdeaReq.java rename to ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/req/RegisterIdeaReq.java index d37beab..4f321e8 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/RegisterIdeaReq.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/req/RegisterIdeaReq.java @@ -1,4 +1,4 @@ -package depth.main.ideac.domain.idea_post.dto; +package depth.main.ideac.domain.idea_post.dto.req; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.Size; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/UpdateIdeaReq.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/req/UpdateIdeaReq.java similarity index 93% rename from ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/UpdateIdeaReq.java rename to ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/req/UpdateIdeaReq.java index 5bbfa4a..4b17313 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/UpdateIdeaReq.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/req/UpdateIdeaReq.java @@ -1,4 +1,4 @@ -package depth.main.ideac.domain.idea_post.dto; +package depth.main.ideac.domain.idea_post.dto.req; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.Size; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/GetAllIdeasRes.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetAllIdeasRes.java similarity index 88% rename from ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/GetAllIdeasRes.java rename to ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetAllIdeasRes.java index 2591903..cbab3cf 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/GetAllIdeasRes.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetAllIdeasRes.java @@ -1,4 +1,4 @@ -package depth.main.ideac.domain.idea_post.dto; +package depth.main.ideac.domain.idea_post.dto.res; import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/GetDetailIdeaRes.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetDetailIdeaRes.java similarity index 87% rename from ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/GetDetailIdeaRes.java rename to ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetDetailIdeaRes.java index dff8f80..934c97b 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/GetDetailIdeaRes.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetDetailIdeaRes.java @@ -1,4 +1,4 @@ -package depth.main.ideac.domain.idea_post.dto; +package depth.main.ideac.domain.idea_post.dto.res; import lombok.Builder; import lombok.Getter; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/presentation/IdeaPostController.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/presentation/IdeaPostController.java index b6b77b4..e7ffa04 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/presentation/IdeaPostController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/presentation/IdeaPostController.java @@ -1,8 +1,8 @@ package depth.main.ideac.domain.idea_post.presentation; import depth.main.ideac.domain.idea_post.application.IdeaPostService; -import depth.main.ideac.domain.idea_post.dto.RegisterIdeaReq; -import depth.main.ideac.domain.idea_post.dto.UpdateIdeaReq; +import depth.main.ideac.domain.idea_post.dto.req.RegisterIdeaReq; +import depth.main.ideac.domain.idea_post.dto.req.UpdateIdeaReq; import depth.main.ideac.global.config.security.token.CurrentUser; import depth.main.ideac.global.config.security.token.UserPrincipal; import depth.main.ideac.global.payload.ErrorResponse; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java b/ideac-user/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java index a28d668..441e7a1 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java @@ -1,7 +1,6 @@ package depth.main.ideac.domain.user.presentation; -import depth.main.ideac.domain.auth.dto.SignUpReq; -import depth.main.ideac.domain.mail.application.MailService; +import depth.main.ideac.domain.auth.dto.req.SignUpReq; import depth.main.ideac.domain.user.application.UserService; import depth.main.ideac.domain.user.dto.PasswordReq; import depth.main.ideac.global.config.security.token.CurrentUser; From b71a6508d2e653bacea88fe3d0b46d83576d135a Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Wed, 10 Jan 2024 22:46:49 +0900 Subject: [PATCH 04/13] =?UTF-8?q?[refactor/72-task]=20mail=20=EB=B3=B8?= =?UTF-8?q?=EB=AC=B8=20=EB=82=B4=EC=9A=A9=20=EC=88=98=EC=A0=95=ED=95=98?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [refactor/72-task] mail 본문 내용 수정하기 --- .../main/ideac/domain/mail/application/MailService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java b/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java index d97eef8..2dbfd01 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java @@ -45,10 +45,13 @@ public ResponseEntity sendEmail(FindPasswordReq findPasswordReq) { simpleMailMessage.setTo(receiveList); // 2. 메일 제목 설정 - simpleMailMessage.setSubject("test_title"); + simpleMailMessage.setSubject("IDEA CAMPUS 비밀번호 재설정"); // 3. 메일 내용 설정 - simpleMailMessage.setText("http://localhost:8080/mail/send-email/" + code); + simpleMailMessage.setText("안녕하세요. IDEA CAMPUS입니다.\n" + + "서비스 이용을 위한 하단 계정의 비밀번호 재설정 이메일 요청 메일입니다.\n" + + "‘비밀번호 재설정’ 버튼을 클릭하여 재설정이 완료하실 수 있습니다." + + "http://localhost:8080/mail/send-email/" + code); // 4. 메일 전송 javaMailSender.send(simpleMailMessage); From 0b7dac27d9e2deacf73e9b80bcc14c76704799bc Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Wed, 10 Jan 2024 23:58:15 +0900 Subject: [PATCH 05/13] =?UTF-8?q?[refactor/72-task]=20@data=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [refactor/72-task] @data 수정 --- .../main/ideac/domain/auth/application/AuthService.java | 7 +++---- .../main/ideac/domain/auth/dto/req/RefreshTokenReq.java | 3 ++- .../depth/main/ideac/domain/auth/dto/req/SignInReq.java | 2 +- .../java/depth/main/ideac/domain/auth/dto/res/AuthRes.java | 3 ++- .../main/ideac/global/config/security/OAuth2Config.java | 5 ++++- .../ideac/domain/auth/presentation/AuthController.java | 1 + 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java index b5069ac..81ea7bc 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java @@ -18,6 +18,7 @@ import depth.main.ideac.global.payload.ErrorCode; import depth.main.ideac.global.payload.Message; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -31,6 +32,7 @@ @RequiredArgsConstructor @Service +@Slf4j public class AuthService { private final AuthenticationManager authenticationManager; @@ -71,7 +73,7 @@ public ResponseEntity signUp(SignUpReq signUpRequest){ //로그인 하기 public ResponseEntity signIn(SignInReq signInReq){ - + System.out.println("signInReq.getEmail() = " + signInReq.getEmail()); Optional user = userRepository.findByEmail(signInReq.getEmail()); DefaultAssert.isTrue(user.isPresent(), "이메일이 틀렸습니다."); @@ -80,7 +82,6 @@ public ResponseEntity signIn(SignInReq signInReq){ throw new DefaultException(ErrorCode.INVALID_CHECK, "정지되었거나 탈퇴된 유저입니다."); } - boolean checkPassword = passwordEncoder.matches(signInReq.getPassword(), findUser.getPassword()); DefaultAssert.isTrue(checkPassword, "비밀번호가 틀렸습니다"); @@ -90,7 +91,6 @@ public ResponseEntity signIn(SignInReq signInReq){ signInReq.getPassword() ) ); - SecurityContextHolder.getContext().setAuthentication(authentication); TokenMapping tokenMapping = customTokenProviderService.createToken(authentication); @@ -104,7 +104,6 @@ public ResponseEntity signIn(SignInReq signInReq){ AuthRes authResponse = AuthRes.builder() .accessToken(tokenMapping.getAccessToken()) .refreshToken(token.getRefreshToken()).build(); - return ResponseEntity.ok(authResponse); } diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/RefreshTokenReq.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/RefreshTokenReq.java index 1adf3e2..8be4fe2 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/RefreshTokenReq.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/RefreshTokenReq.java @@ -5,8 +5,9 @@ import jakarta.validation.constraints.NotNull; import lombok.Builder; import lombok.Data; +import lombok.Getter; -@Data +@Getter public class RefreshTokenReq { @Schema( type = "string", example = "eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE2NTI3OTgxOTh9.6CoxHB_siOuz6PxsxHYQCgUT1_QbdyKTUwStQDutEd1-cIIARbQ0cyrnAmpIgi3IBoLRaqK7N1vXO42nYy4g5g", description="refresh token 입니다." ) diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignInReq.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignInReq.java index 279032e..2795e26 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignInReq.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignInReq.java @@ -9,7 +9,7 @@ import lombok.Getter; -@Data +@Getter public class SignInReq { @Schema( type = "string", example = "idea00@naver.com", description="계정 이메일 입니다.") diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/res/AuthRes.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/res/AuthRes.java index d3beba1..b6eeb2f 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/res/AuthRes.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/res/AuthRes.java @@ -3,8 +3,9 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; import lombok.Data; +import lombok.Getter; -@Data +@Getter public class AuthRes { @Schema( type = "string", example = "eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE2NTI3OTgxOTh9.6CoxHB_siOuz6PxsxHYQCgUT1_QbdyKTUwStQDutEd1-cIIARbQ0cyrnAmpIgi3IBoLRaqK7N1vXO42nYy4g5g" , description="access token 을 출력합니다.") diff --git a/ideac-core/src/main/java/depth/main/ideac/global/config/security/OAuth2Config.java b/ideac-core/src/main/java/depth/main/ideac/global/config/security/OAuth2Config.java index c93c594..689fabb 100644 --- a/ideac-core/src/main/java/depth/main/ideac/global/config/security/OAuth2Config.java +++ b/ideac-core/src/main/java/depth/main/ideac/global/config/security/OAuth2Config.java @@ -1,6 +1,8 @@ package depth.main.ideac.global.config.security; import lombok.Data; +import lombok.Getter; +import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; @@ -13,7 +15,8 @@ public class OAuth2Config { private final Auth auth = new Auth(); private final OAuth2 oauth2 = new OAuth2(); - @Data + @Getter + @Setter public static class Auth { private String tokenSecret; private long accessTokenExpirationMsec; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java b/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java index d98e2f7..5cde293 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java @@ -46,6 +46,7 @@ public ResponseEntity signUp(@Parameter(description = "Schemas의 SignUpReque @PostMapping(value = "/sign-in") public ResponseEntity signIn(@Parameter(description = "Schemas의 SignInRequest를 참고해주세요.") @Valid @RequestBody SignInReq signInReq){ + System.out.println("\"zzz\" = " + "zzz"); return authService.signIn(signInReq); } From 435469a7e1aa22e1d643fbb61f93ba2d97bfd64f Mon Sep 17 00:00:00 2001 From: ibaesuyeon Date: Fri, 12 Jan 2024 18:26:56 +0900 Subject: [PATCH 06/13] =?UTF-8?q?Refactor:=20=ED=94=84=EC=A0=9D,=20?= =?UTF-8?q?=EB=A7=88=EC=9D=B4=ED=8E=98=EC=9D=B4=EC=A7=80=20Swagger=20?= =?UTF-8?q?=EB=AA=85=EC=84=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Response에 Schema 명세 추가 Controller에 Tag 명세 추가 --- .../depth/main/ideac/domain/my_page/dto/response/PostRes.java | 2 ++ .../depth/main/ideac/domain/my_page/dto/response/UserRes.java | 3 +++ .../ideac/domain/my_page/presentation/MyPageController.java | 2 ++ .../domain/project_post/dto/response/ProjectDetailRes.java | 2 ++ .../ideac/domain/project_post/dto/response/ProjectRes.java | 2 ++ .../project_post/presentation/ProjectPostController.java | 2 ++ 6 files changed, 13 insertions(+) diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/my_page/dto/response/PostRes.java b/ideac-user/src/main/java/depth/main/ideac/domain/my_page/dto/response/PostRes.java index 28b9626..f3153fa 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/my_page/dto/response/PostRes.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/my_page/dto/response/PostRes.java @@ -1,5 +1,6 @@ package depth.main.ideac.domain.my_page.dto.response; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.time.LocalDateTime; @@ -8,6 +9,7 @@ @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor +@Schema(description = "내 게시물 조회 Response") public class PostRes { private String title; private String type; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/my_page/dto/response/UserRes.java b/ideac-user/src/main/java/depth/main/ideac/domain/my_page/dto/response/UserRes.java index a7e87f2..d05bfad 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/my_page/dto/response/UserRes.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/my_page/dto/response/UserRes.java @@ -1,5 +1,6 @@ package depth.main.ideac.domain.my_page.dto.response; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @@ -8,6 +9,7 @@ public class UserRes { @Builder @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor + @Schema(description = "Header에 표기될 회원 정보 Response") public static class HeaderInfoRes { private String nickname; private String color; @@ -16,6 +18,7 @@ public static class HeaderInfoRes { @Builder @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor + @Schema(description = "마이페이지에 표기될 회원 정보 Request, 필요에 따라 필터링하여 사용") public static class MyPageInfoRes { private String color; private String name; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/my_page/presentation/MyPageController.java b/ideac-user/src/main/java/depth/main/ideac/domain/my_page/presentation/MyPageController.java index 2b3bec4..7bc6f64 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/my_page/presentation/MyPageController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/my_page/presentation/MyPageController.java @@ -6,11 +6,13 @@ import depth.main.ideac.global.config.security.token.UserPrincipal; import depth.main.ideac.global.payload.ApiResponse; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; +@Tag(name = "MyPage API", description = "마이페이지 관련 API입니다.") @RestController @RequestMapping("/api/my-page") @RequiredArgsConstructor diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/project_post/dto/response/ProjectDetailRes.java b/ideac-user/src/main/java/depth/main/ideac/domain/project_post/dto/response/ProjectDetailRes.java index 204d09c..26304a4 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/project_post/dto/response/ProjectDetailRes.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/project_post/dto/response/ProjectDetailRes.java @@ -1,6 +1,7 @@ package depth.main.ideac.domain.project_post.dto.response; import depth.main.ideac.domain.user.domain.User; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; @@ -13,6 +14,7 @@ @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor +@Schema(description = "프로젝트 상세 조회 Response") public class ProjectDetailRes { @NotBlank(message = "제목이 입력되지 않았습니다.") private String title; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/project_post/dto/response/ProjectRes.java b/ideac-user/src/main/java/depth/main/ideac/domain/project_post/dto/response/ProjectRes.java index 1a6bdff..137ef44 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/project_post/dto/response/ProjectRes.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/project_post/dto/response/ProjectRes.java @@ -1,11 +1,13 @@ package depth.main.ideac.domain.project_post.dto.response; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @Builder @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor +@Schema(description = "프로젝트 목록 조회 Response") public class ProjectRes { private Long id; private boolean booleanWeb; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/project_post/presentation/ProjectPostController.java b/ideac-user/src/main/java/depth/main/ideac/domain/project_post/presentation/ProjectPostController.java index db782bd..796f6a5 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/project_post/presentation/ProjectPostController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/project_post/presentation/ProjectPostController.java @@ -10,6 +10,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; @@ -29,6 +30,7 @@ @RestController @RequestMapping("/api/project") @RequiredArgsConstructor +@Tag(name = "ProjectPost API", description = "프로젝트 갤러리 관련 API입니다.") public class ProjectPostController { private final ProjectPostService projectPostService; From 05f12a9941bdf861b623bff6534040b744652786 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Fri, 12 Jan 2024 23:41:36 +0900 Subject: [PATCH 07/13] =?UTF-8?q?[refactor/72-task]=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [refactor/72-task] 키워드 수정 --- .../main/ideac/domain/mail/application/MailService.java | 1 - .../domain/idea_post/application/IdeaPostService.java | 3 --- .../ideac/domain/idea_post/dto/res/GetAllIdeasRes.java | 9 ++++++++- .../ideac/domain/idea_post/dto/res/GetDetailIdeaRes.java | 7 ++++++- .../idea_post/presentation/IdeaPostController.java | 2 -- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java b/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java index 2dbfd01..17ed956 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java @@ -27,7 +27,6 @@ public class MailService { private final JavaMailSender javaMailSender; private final UserRepository userRepository; private final MailRepository mailRepository; - private final PasswordEncoder passwordEncoder; @Transactional public ResponseEntity sendEmail(FindPasswordReq findPasswordReq) { // 이메일이 존재하는지 확인 diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java index 3fe8c4a..1eb69c3 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java @@ -5,9 +5,6 @@ import depth.main.ideac.domain.idea_post.dto.req.UpdateIdeaReq; import depth.main.ideac.domain.idea_post.dto.res.GetAllIdeasRes; import depth.main.ideac.domain.idea_post.dto.res.GetDetailIdeaRes; -import depth.main.ideac.domain.idea_post.dto.request.*; -import depth.main.ideac.domain.idea_post.dto.response.GetAllIdeasRes; -import depth.main.ideac.domain.idea_post.dto.response.GetDetailIdeaRes; import depth.main.ideac.domain.idea_post.repository.IdeaPostRepository; import depth.main.ideac.domain.user.domain.Role; import depth.main.ideac.domain.user.domain.User; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetAllIdeasRes.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetAllIdeasRes.java index cbab3cf..c31c012 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetAllIdeasRes.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetAllIdeasRes.java @@ -5,14 +5,21 @@ import lombok.Builder; import lombok.Getter; +import java.time.LocalDateTime; +import java.util.List; + + @Getter @Builder @AllArgsConstructor public class GetAllIdeasRes { + private Long id; private String title; @NotBlank(message = "내용이 입력되지 않았습니다.") private String simpleDescription; - private String keyword; + private List keyword; private String nickName; private String color; + private Long hits; + private LocalDateTime createdAt; } diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetDetailIdeaRes.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetDetailIdeaRes.java index 934c97b..1143d54 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetDetailIdeaRes.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetDetailIdeaRes.java @@ -3,17 +3,22 @@ import lombok.Builder; import lombok.Getter; +import java.time.LocalDateTime; +import java.util.List; + @Getter @Builder public class GetDetailIdeaRes { + private Long id; private String color; private String nickName; private String title; - private String keyWord; + private List keyWord; private String simpleDescription; private String detailedDescription; private String url1; private String url2; private Long hits; + private LocalDateTime createdAt; } diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/presentation/IdeaPostController.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/presentation/IdeaPostController.java index 5be50e5..e7ffa04 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/presentation/IdeaPostController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/presentation/IdeaPostController.java @@ -3,8 +3,6 @@ import depth.main.ideac.domain.idea_post.application.IdeaPostService; import depth.main.ideac.domain.idea_post.dto.req.RegisterIdeaReq; import depth.main.ideac.domain.idea_post.dto.req.UpdateIdeaReq; -import depth.main.ideac.domain.idea_post.dto.request.RegisterIdeaReq; -import depth.main.ideac.domain.idea_post.dto.request.UpdateIdeaReq; import depth.main.ideac.global.config.security.token.CurrentUser; import depth.main.ideac.global.config.security.token.UserPrincipal; import depth.main.ideac.global.payload.ErrorResponse; From 498b8a54ac057bc3243921b57c5b5f5b544e8b5c Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Sat, 13 Jan 2024 18:32:51 +0900 Subject: [PATCH 08/13] =?UTF-8?q?[refactor/72-task]=20=EB=A9=94=EC=9D=BC?= =?UTF-8?q?=EB=B3=B4=EB=82=B4=EA=B8=B0=20=EC=84=A4=EC=A0=95=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [refactor/72-task] 메일보내기 설정 수정 --- .../main/ideac/global/config/MailConfig.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/ideac-core/src/main/java/depth/main/ideac/global/config/MailConfig.java b/ideac-core/src/main/java/depth/main/ideac/global/config/MailConfig.java index 7245ded..7f1d23a 100644 --- a/ideac-core/src/main/java/depth/main/ideac/global/config/MailConfig.java +++ b/ideac-core/src/main/java/depth/main/ideac/global/config/MailConfig.java @@ -1,15 +1,15 @@ -package depth.main.ideac.global.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.mail.javamail.JavaMailSender; -import org.springframework.mail.javamail.JavaMailSenderImpl; - -@Configuration -public class MailConfig { - - @Bean - public JavaMailSender javaMailSender() { - return new JavaMailSenderImpl(); - } -} \ No newline at end of file +//package depth.main.ideac.global.config; +// +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.mail.javamail.JavaMailSender; +//import org.springframework.mail.javamail.JavaMailSenderImpl; +// +//@Configuration +//public class MailConfig { +// +// @Bean +// public JavaMailSender javaMailSender() { +// return new JavaMailSenderImpl(); +// } +//} \ No newline at end of file From 41b97aeba0259d61766504e36f8f9739e7ee8c0d Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Sat, 13 Jan 2024 18:33:36 +0900 Subject: [PATCH 09/13] =?UTF-8?q?[refactor/72-task]=20=EB=B9=84=EB=B0=80?= =?UTF-8?q?=EB=B2=88=ED=98=B8=EB=B0=94=EA=BE=B8=EA=B8=B0=20auth=EB=A1=9C?= =?UTF-8?q?=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [refactor/72-task] 비밀번호바꾸기 auth로 이동 --- .idea/vcs.xml | 2 - .../auth/presentation/AuthController.java | 12 ++++++ .../user/presentation/UserController.java | 11 ------ .../domain/auth/application/AuthService.java | 38 +++++++++++++++++++ .../domain/user/application/UserService.java | 31 --------------- .../auth/presentation/AuthController.java | 13 +++++++ .../application/IdeaPostService.java | 6 +-- .../user/presentation/UserController.java | 12 +----- 8 files changed, 65 insertions(+), 60 deletions(-) diff --git a/.idea/vcs.xml b/.idea/vcs.xml index fda1536..94a25f7 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,7 +2,5 @@ - - \ No newline at end of file diff --git a/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java b/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java index 9e29a5b..6fa07ba 100644 --- a/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java +++ b/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java @@ -6,6 +6,7 @@ import depth.main.ideac.domain.auth.dto.res.AuthRes; import depth.main.ideac.domain.auth.dto.req.FindIdReq; import depth.main.ideac.domain.auth.dto.req.SignInReq; +import depth.main.ideac.domain.user.dto.PasswordReq; import depth.main.ideac.global.payload.ErrorResponse; import depth.main.ideac.global.payload.Message; import io.swagger.v3.oas.annotations.Operation; @@ -62,4 +63,15 @@ public ResponseEntity findId(@Parameter(description = "Schemas의 FindIdReque return authService.findId(findIdReq); } + @Operation(summary = "비밀번호 바꾸기", description = "비밀번호를 바꾼다.") + @ApiResponses(value = { + @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(value = "/change-password/{code}") + public ResponseEntity changePassword(@Parameter(description = "Schemas의 PassWordReq를 참고해주세요.") + @Valid @RequestBody PasswordReq passwordReq, + @PathVariable String code) { + return authService.changePassword(passwordReq,code); + } } diff --git a/ideac-admin/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java b/ideac-admin/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java index 62d2db9..26b4c44 100644 --- a/ideac-admin/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java +++ b/ideac-admin/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java @@ -23,17 +23,6 @@ public class UserController { private final UserService userService; - @Operation(summary = "메일 보내기", description = "비밀번호를 찾기위해 메일을 보낸다.") - @ApiResponses(value = { - @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(value = "/change-password/{code}") - public ResponseEntity changePassword(@Parameter(description = "Schemas의 PassWordReq를 참고해주세요.") - @Valid @RequestBody PasswordReq passwordReq, - @PathVariable String code) { - return userService.changePassword(passwordReq,code); - } @Operation(summary = "로그아웃", description = "로그아웃 API입니다.") @ApiResponses(value = { diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java index 0ec4c37..60cfeb4 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java @@ -8,15 +8,19 @@ import depth.main.ideac.domain.auth.dto.req.SignInReq; import depth.main.ideac.domain.auth.dto.req.SignUpReq; import depth.main.ideac.domain.auth.dto.res.AuthRes; +import depth.main.ideac.domain.mail.domain.Verify; +import depth.main.ideac.domain.mail.domain.repository.MailRepository; import depth.main.ideac.domain.user.domain.Role; import depth.main.ideac.domain.user.domain.Status; import depth.main.ideac.domain.user.domain.User; import depth.main.ideac.domain.user.domain.repository.UserRepository; +import depth.main.ideac.domain.user.dto.PasswordReq; import depth.main.ideac.global.DefaultAssert; import depth.main.ideac.global.error.DefaultException; import depth.main.ideac.global.payload.ApiResponse; import depth.main.ideac.global.payload.ErrorCode; import depth.main.ideac.global.payload.Message; +import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; @@ -26,7 +30,9 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDateTime; import java.util.Optional; @@ -41,6 +47,7 @@ public class AuthService { private final UserRepository userRepository; private final TokenRepository tokenRepository; + private final MailRepository mailRepository; // 회원가입 하기 public ResponseEntity signUp(SignUpReq signUpRequest){ @@ -185,4 +192,35 @@ public ResponseEntity doubleCheckEmail(String email) { .build(); return ResponseEntity.ok(apiResponse); } + + @Transactional + public ResponseEntity changePassword(@Valid PasswordReq passwordReq, String code){ + + //검증 + DefaultAssert.isTrue(passwordReq.getPassword().equals(passwordReq.getRePassword()), "비밀번호가 서로 다릅니다."); + //만료시간 검증 + Verify verify = mailRepository.findByCode(code); + + if (verify == null){ + throw new DefaultException(ErrorCode.INVALID_CHECK, "이미변경되었습니다."); + } + + DefaultAssert.isTrue(verify.checkExpiration(LocalDateTime.now()), "만료되었습니다."); + + Optional findUser = userRepository.findByEmail(verify.getEmail()); + + User user = findUser.get(); + user.updatePassWord(passwordEncoder.encode(passwordReq.getPassword())); + + // 인증완료 후 삭제 + mailRepository.delete(verify); + + ApiResponse apiResponse = ApiResponse.builder() + .check(true) + .information(null) + .message("비밀번호를 바꾸었습니다.") + .build(); + + return ResponseEntity.ok(apiResponse); + } } diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java b/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java index 00de936..d4f9254 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java @@ -30,38 +30,7 @@ public class UserService { private final MailRepository mailRepository; private final UserRepository userRepository; - private final PasswordEncoder passwordEncoder; private final TokenRepository tokenRepository; - @Transactional - public ResponseEntity changePassword(@Valid PasswordReq passwordReq, String code){ - - //검증 - DefaultAssert.isTrue(passwordReq.getPassword().equals(passwordReq.getRePassword()), "비밀번호가 서로 다릅니다."); - //만료시간 검증 - Verify verify = mailRepository.findByCode(code); - - if (verify == null){ - throw new DefaultException(ErrorCode.INVALID_CHECK, "이미변경되었습니다."); - } - - DefaultAssert.isTrue(verify.checkExpiration(LocalDateTime.now()), "만료되었습니다."); - - Optional findUser = userRepository.findByEmail(verify.getEmail()); - - User user = findUser.get(); - user.updatePassWord(passwordEncoder.encode(passwordReq.getPassword())); - - // 인증완료 후 삭제 - mailRepository.delete(verify); - - ApiResponse apiResponse = ApiResponse.builder() - .check(true) - .information(null) - .message("비밀번호를 바꾸었습니다.") - .build(); - - return ResponseEntity.ok(apiResponse); - } @Transactional public ResponseEntity deleteUser(UserPrincipal userPrincipal) { diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java b/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java index 5cde293..3aba9b3 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java @@ -6,6 +6,7 @@ import depth.main.ideac.domain.auth.dto.req.FindIdReq; import depth.main.ideac.domain.auth.dto.req.SignInReq; import depth.main.ideac.domain.auth.dto.req.SignUpReq; +import depth.main.ideac.domain.user.dto.PasswordReq; import depth.main.ideac.global.payload.ErrorResponse; import depth.main.ideac.global.payload.Message; import io.swagger.v3.oas.annotations.Operation; @@ -84,5 +85,17 @@ public ResponseEntity doubleCheckEmail(@PathVariable(value = "email") String return authService.doubleCheckEmail(email); } + @Operation(summary = "비밀번호 바꾸기", description = "비밀번호를 바꾼다.") + @ApiResponses(value = { + @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(value = "/change-password/{code}") + public ResponseEntity changePassword(@Parameter(description = "Schemas의 PassWordReq를 참고해주세요.") + @Valid @RequestBody PasswordReq passwordReq, + @PathVariable String code) { + return authService.changePassword(passwordReq,code); + } + } diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java index 1eb69c3..68fe74b 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java @@ -94,11 +94,7 @@ public ResponseEntity getDetailIdea(Long id) { @Transactional public ResponseEntity updateIdea(Long id, UpdateIdeaReq updateIdeaReq) { IdeaPost ideaPost = ideaPostRepository.findById(id).get(); - String[] split = updateIdeaReq.getKeyWord().split(","); -// for (String s : split) { -// System.out.println("s = " + s); -// } - List list = Arrays.asList(split); + ideaPost.setTitle(updateIdeaReq.getTitle()); ideaPost.setKeyword(updateIdeaReq.getKeyWord()); ideaPost.setSimpleDescription(updateIdeaReq.getSimpleDescription()); diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java b/ideac-user/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java index 0dd6fb5..8f0c683 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java @@ -23,17 +23,7 @@ @RequestMapping("/api/user") public class UserController { private final UserService userService; - @Operation(summary = "비밀번호 바꾸기", description = "비밀번호를 바꾼다.") - @ApiResponses(value = { - @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(value = "/change-password/{code}") - public ResponseEntity changePassword(@Parameter(description = "Schemas의 PassWordReq를 참고해주세요.") - @Valid @RequestBody PasswordReq passwordReq, - @PathVariable String code) { - return userService.changePassword(passwordReq,code); - } + @Operation(summary = "회원탈퇴", description = "회원탈퇴를 한다.") @ApiResponses(value = { From e3ff0a6bcca3b51e7b10c97b673eb2742c3163f0 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Sat, 13 Jan 2024 19:24:16 +0900 Subject: [PATCH 10/13] [refactor/72-task] req -> request, res -> response [refactor/72-task] req -> request, res -> response --- .../auth/presentation/AuthController.java | 6 ++--- .../domain/auth/application/AuthService.java | 14 ++++------- .../auth/dto/{req => request}/FindIdReq.java | 2 +- .../dto/{req => request}/RefreshTokenReq.java | 3 +-- .../auth/dto/{req => request}/SignInReq.java | 4 +-- .../auth/dto/{req => request}/SignUpReq.java | 4 +-- .../auth/dto/{res => response}/AuthRes.java | 3 +-- .../domain/mail/application/MailService.java | 1 - .../domain/user/application/UserService.java | 9 +------ .../main/ideac/domain/user/domain/User.java | 2 +- .../auth/presentation/AuthController.java | 9 +++---- .../application/IdeaPostService.java | 8 +++--- .../idea_post/dto/req/RegisterIdeaReq.java | 20 --------------- .../idea_post/dto/req/UpdateIdeaReq.java | 20 --------------- .../idea_post/dto/res/GetAllIdeasRes.java | 25 ------------------- .../idea_post/dto/res/GetDetailIdeaRes.java | 24 ------------------ .../presentation/IdeaPostController.java | 4 +-- .../user/presentation/UserController.java | 3 +-- 18 files changed, 26 insertions(+), 135 deletions(-) rename ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/{req => request}/FindIdReq.java (91%) rename ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/{req => request}/RefreshTokenReq.java (90%) rename ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/{req => request}/SignInReq.java (86%) rename ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/{req => request}/SignUpReq.java (93%) rename ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/{res => response}/AuthRes.java (93%) delete mode 100644 ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/req/RegisterIdeaReq.java delete mode 100644 ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/req/UpdateIdeaReq.java delete mode 100644 ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetAllIdeasRes.java delete mode 100644 ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetDetailIdeaRes.java diff --git a/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java b/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java index 6fa07ba..80343cf 100644 --- a/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java +++ b/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java @@ -3,9 +3,9 @@ import depth.main.ideac.domain.admin.application.AdminService; import depth.main.ideac.domain.auth.application.AuthService; -import depth.main.ideac.domain.auth.dto.res.AuthRes; -import depth.main.ideac.domain.auth.dto.req.FindIdReq; -import depth.main.ideac.domain.auth.dto.req.SignInReq; +import depth.main.ideac.domain.auth.dto.response.AuthRes; +import depth.main.ideac.domain.auth.dto.request.FindIdReq; +import depth.main.ideac.domain.auth.dto.request.SignInReq; import depth.main.ideac.domain.user.dto.PasswordReq; import depth.main.ideac.global.payload.ErrorResponse; import depth.main.ideac.global.payload.Message; diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java index 60cfeb4..ccaaf48 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java @@ -3,11 +3,11 @@ import depth.main.ideac.domain.auth.domain.Token; import depth.main.ideac.domain.auth.domain.repository.TokenRepository; import depth.main.ideac.domain.auth.dto.*; -import depth.main.ideac.domain.auth.dto.req.FindIdReq; -import depth.main.ideac.domain.auth.dto.req.RefreshTokenReq; -import depth.main.ideac.domain.auth.dto.req.SignInReq; -import depth.main.ideac.domain.auth.dto.req.SignUpReq; -import depth.main.ideac.domain.auth.dto.res.AuthRes; +import depth.main.ideac.domain.auth.dto.request.FindIdReq; +import depth.main.ideac.domain.auth.dto.request.RefreshTokenReq; +import depth.main.ideac.domain.auth.dto.request.SignInReq; +import depth.main.ideac.domain.auth.dto.request.SignUpReq; +import depth.main.ideac.domain.auth.dto.response.AuthRes; import depth.main.ideac.domain.mail.domain.Verify; import depth.main.ideac.domain.mail.domain.repository.MailRepository; import depth.main.ideac.domain.user.domain.Role; @@ -125,7 +125,6 @@ public ResponseEntity findId(FindIdReq findIdReq) { ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(user.getEmail()) - .message("가입하신 아이디를 찾아왔어요!") .build(); return ResponseEntity.ok(apiResponse); } @@ -178,7 +177,6 @@ public ResponseEntity doubleCheckNickname(String nickname) { ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(userRepository.findByNickname(nickname).isEmpty()) - .message("닉네임 검증 완료") .build(); return ResponseEntity.ok(apiResponse); } @@ -188,7 +186,6 @@ public ResponseEntity doubleCheckEmail(String email) { ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(userRepository.findByEmail(email).isEmpty()) - .message("이메일 검증 완료") .build(); return ResponseEntity.ok(apiResponse); } @@ -218,7 +215,6 @@ public ResponseEntity changePassword(@Valid PasswordReq passwordReq, String c ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(null) - .message("비밀번호를 바꾸었습니다.") .build(); return ResponseEntity.ok(apiResponse); diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/FindIdReq.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/FindIdReq.java similarity index 91% rename from ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/FindIdReq.java rename to ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/FindIdReq.java index 8f418a2..5d599b2 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/FindIdReq.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/FindIdReq.java @@ -1,4 +1,4 @@ -package depth.main.ideac.domain.auth.dto.req; +package depth.main.ideac.domain.auth.dto.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/RefreshTokenReq.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/RefreshTokenReq.java similarity index 90% rename from ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/RefreshTokenReq.java rename to ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/RefreshTokenReq.java index 8be4fe2..9f14b26 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/RefreshTokenReq.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/RefreshTokenReq.java @@ -1,10 +1,9 @@ -package depth.main.ideac.domain.auth.dto.req; +package depth.main.ideac.domain.auth.dto.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.Builder; -import lombok.Data; import lombok.Getter; @Getter diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignInReq.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/SignInReq.java similarity index 86% rename from ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignInReq.java rename to ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/SignInReq.java index 2795e26..4098563 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignInReq.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/SignInReq.java @@ -1,11 +1,9 @@ -package depth.main.ideac.domain.auth.dto.req; +package depth.main.ideac.domain.auth.dto.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Pattern; -import lombok.Data; import lombok.Getter; diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignUpReq.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/SignUpReq.java similarity index 93% rename from ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignUpReq.java rename to ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/SignUpReq.java index ffe4c3d..beb64ba 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/req/SignUpReq.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/SignUpReq.java @@ -1,11 +1,9 @@ -package depth.main.ideac.domain.auth.dto.req; +package depth.main.ideac.domain.auth.dto.request; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.Pattern; import jakarta.validation.constraints.Size; -import lombok.Data; import lombok.Getter; @Getter diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/res/AuthRes.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/response/AuthRes.java similarity index 93% rename from ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/res/AuthRes.java rename to ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/response/AuthRes.java index b6eeb2f..22a1403 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/res/AuthRes.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/response/AuthRes.java @@ -1,8 +1,7 @@ -package depth.main.ideac.domain.auth.dto.res; +package depth.main.ideac.domain.auth.dto.response; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; -import lombok.Data; import lombok.Getter; @Getter diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java b/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java index 17ed956..1f7ffef 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java @@ -62,7 +62,6 @@ public ResponseEntity sendEmail(FindPasswordReq findPasswordReq) { ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(verify.getCode()) - .message("메일을 보냈어요!") .build(); return ResponseEntity.ok(apiResponse); diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java b/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java index d4f9254..da380da 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/user/application/UserService.java @@ -2,26 +2,19 @@ import depth.main.ideac.domain.auth.domain.Token; import depth.main.ideac.domain.auth.domain.repository.TokenRepository; -import depth.main.ideac.domain.auth.dto.req.SignUpReq; -import depth.main.ideac.domain.mail.domain.Verify; +import depth.main.ideac.domain.auth.dto.request.SignUpReq; import depth.main.ideac.domain.mail.domain.repository.MailRepository; import depth.main.ideac.domain.user.domain.Status; import depth.main.ideac.domain.user.domain.User; import depth.main.ideac.domain.user.domain.repository.UserRepository; -import depth.main.ideac.domain.user.dto.PasswordReq; import depth.main.ideac.global.DefaultAssert; import depth.main.ideac.global.config.security.token.UserPrincipal; -import depth.main.ideac.global.error.DefaultException; import depth.main.ideac.global.payload.ApiResponse; -import depth.main.ideac.global.payload.ErrorCode; -import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; -import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.time.LocalDateTime; import java.util.Optional; @Service diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/User.java b/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/User.java index effaea5..9dccbce 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/User.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/User.java @@ -1,6 +1,6 @@ package depth.main.ideac.domain.user.domain; -import depth.main.ideac.domain.auth.dto.req.SignUpReq; +import depth.main.ideac.domain.auth.dto.request.SignUpReq; import depth.main.ideac.domain.club_post.ClubPost; import depth.main.ideac.domain.common.BaseEntity; import depth.main.ideac.domain.idea_post.IdeaPost; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java b/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java index 3aba9b3..25ce9d3 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java @@ -2,10 +2,10 @@ import depth.main.ideac.domain.auth.application.AuthService; -import depth.main.ideac.domain.auth.dto.res.AuthRes; -import depth.main.ideac.domain.auth.dto.req.FindIdReq; -import depth.main.ideac.domain.auth.dto.req.SignInReq; -import depth.main.ideac.domain.auth.dto.req.SignUpReq; +import depth.main.ideac.domain.auth.dto.response.AuthRes; +import depth.main.ideac.domain.auth.dto.request.FindIdReq; +import depth.main.ideac.domain.auth.dto.request.SignInReq; +import depth.main.ideac.domain.auth.dto.request.SignUpReq; import depth.main.ideac.domain.user.dto.PasswordReq; import depth.main.ideac.global.payload.ErrorResponse; import depth.main.ideac.global.payload.Message; @@ -47,7 +47,6 @@ public ResponseEntity signUp(@Parameter(description = "Schemas의 SignUpReque @PostMapping(value = "/sign-in") public ResponseEntity signIn(@Parameter(description = "Schemas의 SignInRequest를 참고해주세요.") @Valid @RequestBody SignInReq signInReq){ - System.out.println("\"zzz\" = " + "zzz"); return authService.signIn(signInReq); } diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java index 68fe74b..034071e 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java @@ -1,10 +1,10 @@ package depth.main.ideac.domain.idea_post.application; import depth.main.ideac.domain.idea_post.IdeaPost; -import depth.main.ideac.domain.idea_post.dto.req.RegisterIdeaReq; -import depth.main.ideac.domain.idea_post.dto.req.UpdateIdeaReq; -import depth.main.ideac.domain.idea_post.dto.res.GetAllIdeasRes; -import depth.main.ideac.domain.idea_post.dto.res.GetDetailIdeaRes; +import depth.main.ideac.domain.idea_post.dto.request.RegisterIdeaReq; +import depth.main.ideac.domain.idea_post.dto.request.UpdateIdeaReq; +import depth.main.ideac.domain.idea_post.dto.response.GetAllIdeasRes; +import depth.main.ideac.domain.idea_post.dto.response.GetDetailIdeaRes; import depth.main.ideac.domain.idea_post.repository.IdeaPostRepository; import depth.main.ideac.domain.user.domain.Role; import depth.main.ideac.domain.user.domain.User; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/req/RegisterIdeaReq.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/req/RegisterIdeaReq.java deleted file mode 100644 index 4f321e8..0000000 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/req/RegisterIdeaReq.java +++ /dev/null @@ -1,20 +0,0 @@ -package depth.main.ideac.domain.idea_post.dto.req; - -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Size; -import lombok.Getter; - -@Getter -public class RegisterIdeaReq { - @NotBlank(message = "제목이 입력되지 않았습니다.") - @Size(max = 15, message = "제목은 최대 15자까지 입력 가능합니다.") - private String title; - @NotBlank(message = "내용이 입력되지 않았습니다.") - @Size(max = 50, message = "간단 설명은 최대 50자까지 입력 가능합니다.") - private String simpleDescription; - private String keyword; - @NotBlank(message = "내용이 입력되지 않았습니다.") - private String detailedDescription; - private String url1; - private String url2; -} diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/req/UpdateIdeaReq.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/req/UpdateIdeaReq.java deleted file mode 100644 index 4b17313..0000000 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/req/UpdateIdeaReq.java +++ /dev/null @@ -1,20 +0,0 @@ -package depth.main.ideac.domain.idea_post.dto.req; - -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Size; -import lombok.Getter; - -@Getter -public class UpdateIdeaReq { - @NotBlank(message = "제목이 입력되지 않았습니다.") - @Size(max = 15, message = "제목은 최대 15자까지 입력 가능합니다.") - private String title; - private String keyWord; - @NotBlank(message = "내용이 입력되지 않았습니다.") - @Size(max = 50, message = "간단 설명은 최대 50자까지 입력 가능합니다.") - private String simpleDescription; - @NotBlank(message = "내용이 입력되지 않았습니다.") - private String detailedDescription; - private String url1; - private String url2; -} diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetAllIdeasRes.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetAllIdeasRes.java deleted file mode 100644 index c31c012..0000000 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetAllIdeasRes.java +++ /dev/null @@ -1,25 +0,0 @@ -package depth.main.ideac.domain.idea_post.dto.res; - -import jakarta.validation.constraints.NotBlank; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; - -import java.time.LocalDateTime; -import java.util.List; - - -@Getter -@Builder -@AllArgsConstructor -public class GetAllIdeasRes { - private Long id; - private String title; - @NotBlank(message = "내용이 입력되지 않았습니다.") - private String simpleDescription; - private List keyword; - private String nickName; - private String color; - private Long hits; - private LocalDateTime createdAt; -} diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetDetailIdeaRes.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetDetailIdeaRes.java deleted file mode 100644 index 1143d54..0000000 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/res/GetDetailIdeaRes.java +++ /dev/null @@ -1,24 +0,0 @@ -package depth.main.ideac.domain.idea_post.dto.res; - -import lombok.Builder; -import lombok.Getter; - -import java.time.LocalDateTime; -import java.util.List; - -@Getter -@Builder -public class GetDetailIdeaRes { - - private Long id; - private String color; - private String nickName; - private String title; - private List keyWord; - private String simpleDescription; - private String detailedDescription; - private String url1; - private String url2; - private Long hits; - private LocalDateTime createdAt; -} diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/presentation/IdeaPostController.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/presentation/IdeaPostController.java index e7ffa04..e48f72c 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/presentation/IdeaPostController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/presentation/IdeaPostController.java @@ -1,8 +1,8 @@ package depth.main.ideac.domain.idea_post.presentation; import depth.main.ideac.domain.idea_post.application.IdeaPostService; -import depth.main.ideac.domain.idea_post.dto.req.RegisterIdeaReq; -import depth.main.ideac.domain.idea_post.dto.req.UpdateIdeaReq; +import depth.main.ideac.domain.idea_post.dto.request.RegisterIdeaReq; +import depth.main.ideac.domain.idea_post.dto.request.UpdateIdeaReq; import depth.main.ideac.global.config.security.token.CurrentUser; import depth.main.ideac.global.config.security.token.UserPrincipal; import depth.main.ideac.global.payload.ErrorResponse; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java b/ideac-user/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java index 8f0c683..5e6df17 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java @@ -1,8 +1,7 @@ package depth.main.ideac.domain.user.presentation; -import depth.main.ideac.domain.auth.dto.req.SignUpReq; +import depth.main.ideac.domain.auth.dto.request.SignUpReq; import depth.main.ideac.domain.user.application.UserService; -import depth.main.ideac.domain.user.dto.PasswordReq; import depth.main.ideac.global.config.security.token.CurrentUser; import depth.main.ideac.global.config.security.token.UserPrincipal; import depth.main.ideac.global.payload.ErrorResponse; From b850d80609d0fe8da3ebf32384580535a598e3e7 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Sat, 13 Jan 2024 19:45:49 +0900 Subject: [PATCH 11/13] [refactor/72-task] req -> request, res -> response [refactor/72-task] req -> request, res -> response --- .../depth/main/ideac/domain/home/application/HomeService.java | 2 +- .../main/ideac/domain/home/presentation/HomeController.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/home/application/HomeService.java b/ideac-user/src/main/java/depth/main/ideac/domain/home/application/HomeService.java index 0c57c98..9487219 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/home/application/HomeService.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/home/application/HomeService.java @@ -5,7 +5,7 @@ import depth.main.ideac.domain.club_post.dto.response.ClubPostRes; import depth.main.ideac.domain.club_post.repository.ClubPostRepository; import depth.main.ideac.domain.idea_post.IdeaPost; -import depth.main.ideac.domain.idea_post.dto.res.GetAllIdeasRes; +import depth.main.ideac.domain.idea_post.dto.response.GetAllIdeasRes; import depth.main.ideac.domain.idea_post.repository.IdeaPostRepository; import depth.main.ideac.domain.project_post.ProjectPost; import depth.main.ideac.domain.project_post.ProjectPostImage; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/home/presentation/HomeController.java b/ideac-user/src/main/java/depth/main/ideac/domain/home/presentation/HomeController.java index 3daa4d3..50e1e89 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/home/presentation/HomeController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/home/presentation/HomeController.java @@ -2,7 +2,7 @@ import depth.main.ideac.domain.club_post.dto.response.ClubPostRes; import depth.main.ideac.domain.home.application.HomeService; -import depth.main.ideac.domain.idea_post.dto.res.GetAllIdeasRes; +import depth.main.ideac.domain.idea_post.dto.response.GetAllIdeasRes; import depth.main.ideac.domain.project_post.dto.response.ProjectRes; import depth.main.ideac.global.payload.ApiResponse; import io.swagger.v3.oas.annotations.Operation; From b067dfb96cec2f74c5ed961dd351d02c23465006 Mon Sep 17 00:00:00 2001 From: ibaesuyeon Date: Sat, 13 Jan 2024 21:07:08 +0900 Subject: [PATCH 12/13] =?UTF-8?q?Refactor:=20=ED=8C=8C=EC=9D=BC=EC=9D=B4?= =?UTF-8?q?=20=EC=97=86=EB=8A=94=20=EA=B2=BD=EC=9A=B0=EC=97=90=20=EB=8C=80?= =?UTF-8?q?=ED=95=9C=20exception=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../error/DefaultNullPointerException.java | 6 ++++ .../application/ClubPostService.java | 12 ++++---- .../application/ProjectPostService.java | 13 ++++----- .../{FileService.java => S3Service.java} | 28 +++++++++++++------ 4 files changed, 38 insertions(+), 21 deletions(-) rename ideac-user/src/main/java/depth/main/ideac/global/service/{FileService.java => S3Service.java} (66%) diff --git a/ideac-core/src/main/java/depth/main/ideac/global/error/DefaultNullPointerException.java b/ideac-core/src/main/java/depth/main/ideac/global/error/DefaultNullPointerException.java index 6db8937..4576e9a 100644 --- a/ideac-core/src/main/java/depth/main/ideac/global/error/DefaultNullPointerException.java +++ b/ideac-core/src/main/java/depth/main/ideac/global/error/DefaultNullPointerException.java @@ -7,9 +7,15 @@ public class DefaultNullPointerException extends NullPointerException{ private ErrorCode errorCode; + private String message; public DefaultNullPointerException(ErrorCode errorCode) { super(errorCode.getMessage()); this.errorCode = errorCode; } + public DefaultNullPointerException(ErrorCode errorCode, String message) { + super(errorCode.getMessage()); + this.errorCode = errorCode; + this.message = message; + } } diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/club_post/application/ClubPostService.java b/ideac-user/src/main/java/depth/main/ideac/domain/club_post/application/ClubPostService.java index 5bff447..7e0ec18 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/club_post/application/ClubPostService.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/club_post/application/ClubPostService.java @@ -13,7 +13,7 @@ import depth.main.ideac.global.error.DefaultException; import depth.main.ideac.global.payload.ErrorCode; import depth.main.ideac.domain.user.domain.repository.UserRepository; -import depth.main.ideac.global.service.FileService; +import depth.main.ideac.global.service.S3Service; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; @@ -34,7 +34,7 @@ public class ClubPostService { private final UserRepository userRepository; private final ClubPostRepository clubPostRepository; private final ClubPostImageRepository clubPostImageRepository; - private final FileService fileService; + private final S3Service s3Service; // 전체 조회 public Page getAllClubPosts(Pageable pageable) { @@ -151,16 +151,16 @@ public void uploadFile(ClubPost clubPost, List images) throws IOE boolean isFirstImage = true; for (MultipartFile image : images) { - String s3ImageKey = fileService.uploadFile(image, getClass().getSimpleName()); + String s3key = s3Service.uploadFile(image, getClass().getSimpleName()); // 첫 번째 이미지인 경우에만 thumbnail로 설정 boolean isThumbnail = isFirstImage; isFirstImage = false; clubPostImages.add(ClubPostImage.builder() - .imagePath(fileService.getUrl(s3ImageKey)) + .imagePath(s3Service.getUrl(s3key)) .isThumbnail(isThumbnail) - .s3key(s3ImageKey) + .s3key(s3key) .clubPost(clubPost) .build()); } @@ -171,7 +171,7 @@ public void uploadFile(ClubPost clubPost, List images) throws IOE public void deleteFile(Long clubId){ List images = clubPostImageRepository.findByClubPostId(clubId); for(ClubPostImage image : images) { - fileService.deleteFile(image.getS3key()); //s3 삭제 + s3Service.deleteFile(image.getS3key()); //s3 삭제 clubPostImageRepository.deleteById(image.getId()); //엔티티 삭제 } } diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/project_post/application/ProjectPostService.java b/ideac-user/src/main/java/depth/main/ideac/domain/project_post/application/ProjectPostService.java index 3236966..11852cc 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/project_post/application/ProjectPostService.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/project_post/application/ProjectPostService.java @@ -13,9 +13,8 @@ import depth.main.ideac.domain.user.domain.repository.UserRepository; import depth.main.ideac.global.error.DefaultException; import depth.main.ideac.global.payload.ErrorCode; -import depth.main.ideac.global.service.FileService; +import depth.main.ideac.global.service.S3Service; import lombok.RequiredArgsConstructor; -import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.*; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.ValueOperations; @@ -35,7 +34,7 @@ @RequiredArgsConstructor public class ProjectPostService { - private final FileService fileService; + private final S3Service s3Service; private final ProjectPostRepository projectPostRepository; private final ProjectPostImageRepository projectPostImageRepository; private final UserRepository userRepository; @@ -212,16 +211,16 @@ public void uploadFile(ProjectPost projectPost, List images) thro boolean isFirstImage = true; for (MultipartFile image : images) { - String s3ImageKey = fileService.uploadFile(image, getClass().getSimpleName()); + String s3key = s3Service.uploadFile(image, getClass().getSimpleName()); // 첫 번째 이미지인 경우에만 thumbnail로 설정 boolean isThumbnail = isFirstImage; isFirstImage = false; projectPostImages.add(ProjectPostImage.builder() - .imagePath(fileService.getUrl(s3ImageKey)) + .imagePath(s3Service.getUrl(s3key)) .isThumbnail(isThumbnail) - .s3key(s3ImageKey) + .s3key(s3key) .projectPost(projectPost) .build()); } @@ -232,7 +231,7 @@ public void uploadFile(ProjectPost projectPost, List images) thro public void deleteFile(Long projectId){ List images = projectPostImageRepository.findByProjectPostId(projectId); for(ProjectPostImage image : images) { - fileService.deleteFile(image.getS3key()); //s3 삭제 + s3Service.deleteFile(image.getS3key()); //s3 삭제 projectPostImageRepository.deleteById(image.getId()); //엔티티 삭제 } } diff --git a/ideac-user/src/main/java/depth/main/ideac/global/service/FileService.java b/ideac-user/src/main/java/depth/main/ideac/global/service/S3Service.java similarity index 66% rename from ideac-user/src/main/java/depth/main/ideac/global/service/FileService.java rename to ideac-user/src/main/java/depth/main/ideac/global/service/S3Service.java index 054c738..a776d76 100644 --- a/ideac-user/src/main/java/depth/main/ideac/global/service/FileService.java +++ b/ideac-user/src/main/java/depth/main/ideac/global/service/S3Service.java @@ -5,6 +5,9 @@ import com.amazonaws.services.s3.model.DeleteObjectRequest; import com.amazonaws.services.s3.model.ObjectMetadata; import com.amazonaws.services.s3.model.PutObjectRequest; +import depth.main.ideac.global.DefaultAssert; +import depth.main.ideac.global.error.DefaultNullPointerException; +import depth.main.ideac.global.payload.ErrorCode; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -18,7 +21,7 @@ @Service @Transactional(readOnly = true) @RequiredArgsConstructor -public class FileService { +public class S3Service { @Value("${cloud.aws.s3.bucket}") private String BUCKET; @@ -26,6 +29,9 @@ public class FileService { @Transactional public String uploadFile(MultipartFile file, String className) throws IOException { + if(file == null){ + throw new DefaultNullPointerException(ErrorCode.INVALID_PARAMETER, "파일을 첨부해주세요.."); + } String fileName = convertToRandomName(file.getOriginalFilename()); ObjectMetadata objectMetadata = new ObjectMetadata(); @@ -36,12 +42,15 @@ public String uploadFile(MultipartFile file, String className) throws IOExceptio String filePath = BUCKET + "/image/" + className; amazonS3.putObject(new PutObjectRequest(filePath, fileName, inputStream, objectMetadata) .withCannedAcl(CannedAccessControlList.PublicRead)); - String s3ImageKey = "image/" + className + "/" + fileName; - return s3ImageKey; + String s3key = "image/" + className + "/" + fileName; + return s3key; } - - public void deleteFile(String s3ImageKey) { - amazonS3.deleteObject(new DeleteObjectRequest(BUCKET, s3ImageKey)); + @Transactional + public void deleteFile(String s3key) { + if(s3key == null){ + throw new DefaultNullPointerException(ErrorCode.INVALID_PARAMETER, "삭제하려는 파일을 찾을 수 없습니다."); + } + amazonS3.deleteObject(new DeleteObjectRequest(BUCKET, s3key)); } public String convertToRandomName(String originalFileName) { @@ -49,7 +58,10 @@ public String convertToRandomName(String originalFileName) { return UUID.randomUUID().toString().concat(fileExtension); } - public String getUrl(String s3ImageKey) { - return amazonS3.getUrl(BUCKET, s3ImageKey).toString(); + public String getUrl(String s3key) { + if(s3key == null){ + throw new DefaultNullPointerException(ErrorCode.INVALID_PARAMETER, "파일을 찾을 수 없습니다."); + } + return amazonS3.getUrl(BUCKET, s3key).toString(); } } From 854bf7d6400dd4d24872b7a8323bf451c21090de Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Sat, 13 Jan 2024 22:38:56 +0900 Subject: [PATCH 13/13] =?UTF-8?q?[refactor/72-task]=20=EA=B2=80=EC=A6=9D?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [refactor/72-task] 검증로직 추가 --- .../ideac/domain/auth/presentation/AuthController.java | 2 +- .../ideac/domain/user/presentation/UserController.java | 2 -- .../main/ideac/domain/auth/application/AuthService.java | 5 +++-- .../domain/{user/dto => auth/dto/request}/PasswordReq.java | 2 +- .../main/ideac/domain/auth/dto/request/SignUpReq.java | 3 +++ .../main/ideac/domain/mail/application/MailService.java | 3 --- .../java/depth/main/ideac/domain/user/domain/User.java | 1 - .../ideac/domain/auth/presentation/AuthController.java | 2 +- .../domain/idea_post/application/IdeaPostService.java | 7 ------- .../domain/idea_post/dto/request/RegisterIdeaReq.java | 1 + 10 files changed, 10 insertions(+), 18 deletions(-) rename ideac-core/src/main/java/depth/main/ideac/domain/{user/dto => auth/dto/request}/PasswordReq.java (90%) diff --git a/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java b/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java index 80343cf..b8d7ace 100644 --- a/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java +++ b/ideac-admin/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java @@ -6,7 +6,7 @@ import depth.main.ideac.domain.auth.dto.response.AuthRes; import depth.main.ideac.domain.auth.dto.request.FindIdReq; import depth.main.ideac.domain.auth.dto.request.SignInReq; -import depth.main.ideac.domain.user.dto.PasswordReq; +import depth.main.ideac.domain.auth.dto.request.PasswordReq; import depth.main.ideac.global.payload.ErrorResponse; import depth.main.ideac.global.payload.Message; import io.swagger.v3.oas.annotations.Operation; diff --git a/ideac-admin/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java b/ideac-admin/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java index 26b4c44..940fd83 100644 --- a/ideac-admin/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java +++ b/ideac-admin/src/main/java/depth/main/ideac/domain/user/presentation/UserController.java @@ -1,7 +1,6 @@ package depth.main.ideac.domain.user.presentation; import depth.main.ideac.domain.user.application.UserService; -import depth.main.ideac.domain.user.dto.PasswordReq; import depth.main.ideac.global.config.security.token.CurrentUser; import depth.main.ideac.global.config.security.token.UserPrincipal; import depth.main.ideac.global.payload.ErrorResponse; @@ -12,7 +11,6 @@ import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; -import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java index ccaaf48..cb3a418 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/application/AuthService.java @@ -14,7 +14,7 @@ import depth.main.ideac.domain.user.domain.Status; import depth.main.ideac.domain.user.domain.User; import depth.main.ideac.domain.user.domain.repository.UserRepository; -import depth.main.ideac.domain.user.dto.PasswordReq; +import depth.main.ideac.domain.auth.dto.request.PasswordReq; import depth.main.ideac.global.DefaultAssert; import depth.main.ideac.global.error.DefaultException; import depth.main.ideac.global.payload.ApiResponse; @@ -52,6 +52,8 @@ public class AuthService { // 회원가입 하기 public ResponseEntity signUp(SignUpReq signUpRequest){ + DefaultAssert.isTrue(signUpRequest.getPassword().equals(signUpRequest.getCheckPassword()), "비밀번호가 서로 다릅니다."); + User user = User.builder() .email(signUpRequest.getIdEmail()) .password(passwordEncoder.encode(signUpRequest.getPassword())) @@ -80,7 +82,6 @@ public ResponseEntity signUp(SignUpReq signUpRequest){ //로그인 하기 public ResponseEntity signIn(SignInReq signInReq){ - System.out.println("signInReq.getEmail() = " + signInReq.getEmail()); Optional user = userRepository.findByEmail(signInReq.getEmail()); DefaultAssert.isTrue(user.isPresent(), "이메일이 틀렸습니다."); diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/user/dto/PasswordReq.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/PasswordReq.java similarity index 90% rename from ideac-core/src/main/java/depth/main/ideac/domain/user/dto/PasswordReq.java rename to ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/PasswordReq.java index f80e285..acd7366 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/user/dto/PasswordReq.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/PasswordReq.java @@ -1,4 +1,4 @@ -package depth.main.ideac.domain.user.dto; +package depth.main.ideac.domain.auth.dto.request; import jakarta.validation.constraints.Pattern; import lombok.Getter; diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/SignUpReq.java b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/SignUpReq.java index beb64ba..fd3338e 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/SignUpReq.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/auth/dto/request/SignUpReq.java @@ -1,6 +1,7 @@ package depth.main.ideac.domain.auth.dto.request; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.persistence.Column; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.Pattern; import jakarta.validation.constraints.Size; @@ -13,6 +14,7 @@ public class SignUpReq { private String idEmail; @Schema( type = "string", example = "홍길동", description="이름") + @Size(min = 2, message = "2자 이상 입력해주세요") @NotBlank private String name; @@ -33,6 +35,7 @@ public class SignUpReq { @Schema( type = "string", example = "01012341234", description="휴대폰번호") @NotBlank + @Pattern(regexp = "^01([0|1|6|7|8|9])?([0-9]{3,4})?([0-9]{4})$", message = "번호를 정확하게 입력해주세요") private String phoneNumber; @Schema( type = "string", example = "depth", description="소속 동아리") diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java b/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java index 1f7ffef..a456716 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/mail/application/MailService.java @@ -4,17 +4,14 @@ import depth.main.ideac.domain.mail.domain.repository.MailRepository; import depth.main.ideac.domain.mail.dto.FindPasswordReq; import depth.main.ideac.domain.user.domain.User; -import depth.main.ideac.domain.user.dto.PasswordReq; import depth.main.ideac.domain.user.domain.repository.UserRepository; import depth.main.ideac.global.DefaultAssert; import depth.main.ideac.global.payload.ApiResponse; -import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.RandomStringUtils; import org.springframework.http.ResponseEntity; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; -import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/User.java b/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/User.java index 9dccbce..8159203 100644 --- a/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/User.java +++ b/ideac-core/src/main/java/depth/main/ideac/domain/user/domain/User.java @@ -27,7 +27,6 @@ public class User extends BaseEntity { private Long id; @Email(message = "이메일 형식이어야 합니다.") - // @Pattern @NotBlank(message = "이메일이 입력되지 않았습니다.") private String email; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java b/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java index 25ce9d3..17f9867 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/auth/presentation/AuthController.java @@ -6,7 +6,7 @@ import depth.main.ideac.domain.auth.dto.request.FindIdReq; import depth.main.ideac.domain.auth.dto.request.SignInReq; import depth.main.ideac.domain.auth.dto.request.SignUpReq; -import depth.main.ideac.domain.user.dto.PasswordReq; +import depth.main.ideac.domain.auth.dto.request.PasswordReq; import depth.main.ideac.global.payload.ErrorResponse; import depth.main.ideac.global.payload.Message; import io.swagger.v3.oas.annotations.Operation; diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java index 034071e..3eda3ed 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/application/IdeaPostService.java @@ -64,9 +64,6 @@ public ResponseEntity getDetailIdea(Long id) { IdeaPost ideaPost = ideaPostRepository.findById(id).get(); String[] split = ideaPost.getKeyword().split(","); -// for (String s : split) { -// System.out.println("s = " + s); -// } List list = Arrays.asList(split); GetDetailIdeaRes getDetailIdeaRes = GetDetailIdeaRes.builder() .id(ideaPost.getId()) @@ -85,7 +82,6 @@ public ResponseEntity getDetailIdea(Long id) { ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(getDetailIdeaRes) - .message("상세내용을 가져왔습니다.") .build(); return ResponseEntity.ok(apiResponse); } @@ -105,7 +101,6 @@ public ResponseEntity updateIdea(Long id, UpdateIdeaReq updateIdeaReq) { ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(null) - .message("아이디어가 업데이트 되었습니다.!") .build(); return ResponseEntity.ok(apiResponse); @@ -118,7 +113,6 @@ public ResponseEntity deleteIdea(Long id) { ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(null) - .message("아이디어가 삭제되었습니다.") .build(); return ResponseEntity.ok(apiResponse); } @@ -147,7 +141,6 @@ public ResponseEntity getAllIdea(int page, int size, String sortBy) { ApiResponse apiResponse = ApiResponse.builder() .check(true) .information(getAllIdeasRes) - .message("조회목록들입니다.") .build(); return ResponseEntity.ok(apiResponse); } diff --git a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/request/RegisterIdeaReq.java b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/request/RegisterIdeaReq.java index 738ee46..b46ce27 100644 --- a/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/request/RegisterIdeaReq.java +++ b/ideac-user/src/main/java/depth/main/ideac/domain/idea_post/dto/request/RegisterIdeaReq.java @@ -12,6 +12,7 @@ public class RegisterIdeaReq { @NotBlank(message = "내용이 입력되지 않았습니다.") @Size(max = 50, message = "간단 설명은 최대 50자까지 입력 가능합니다.") private String simpleDescription; + @NotBlank private String keyword; @NotBlank(message = "내용이 입력되지 않았습니다.") private String detailedDescription;