From d69c22407b152c179e1fbfc83dfc68165481131d Mon Sep 17 00:00:00 2001 From: Jeongho Date: Sat, 18 May 2024 16:58:47 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20=EC=9D=B8?= =?UTF-8?q?=EA=B0=80=EC=BD=94=EB=93=9C=20return=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oauth/controller/KakaoController.java | 4 +-- .../user/controller/UserController.java | 21 ++++++++++----- .../user/dto/response/ReadCalenderRes.java | 2 -- .../response/ReadExperienceProfileRes.java | 26 +++++++++++++++++++ .../domain/user/service/UserService.java | 8 ++++++ 5 files changed, 50 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/meetup/teame/backend/domain/user/dto/response/ReadExperienceProfileRes.java diff --git a/src/main/java/com/meetup/teame/backend/domain/auth/oauth/controller/KakaoController.java b/src/main/java/com/meetup/teame/backend/domain/auth/oauth/controller/KakaoController.java index a3ef57c..81cb05f 100644 --- a/src/main/java/com/meetup/teame/backend/domain/auth/oauth/controller/KakaoController.java +++ b/src/main/java/com/meetup/teame/backend/domain/auth/oauth/controller/KakaoController.java @@ -33,7 +33,7 @@ public class KakaoController { 등록되지 않은 사용자면 "/sign-up"을 요청해서 거주지 정보를 추가로 받아줘야 합니다. """) @GetMapping("/login/kakao") - public ResponseEntity kakaoLogin(@RequestParam String code) throws JsonProcessingException { + public ResponseEntity kakaoLogin(@RequestParam String code) throws JsonProcessingException { String kakaoAccessToken = kakaoService.getKakaoAccessToken(code); //인가코드로 카카오 엑세스 토큰 받아오기 CreateOauthUserRequest request = kakaoService.getKakaoInfo(kakaoAccessToken); //엑세스 토큰으로 카카오 사용자 정보 받아오기 boolean checkExist = loginService.userExists(request.getEmail()); @@ -41,7 +41,7 @@ public ResponseEntity kakaoLogin(@RequestParam String code) throws JsonP User user = userRepository.findByEmail(request.getEmail()); HttpHeaders headers = kakaoService.getLoginHeader(user); - return ResponseEntity.ok().headers(headers).body("login"); + return ResponseEntity.ok().headers(headers).body(request); //로그인 처리하기 } else { //신규 회원 return ResponseEntity.ok().body(request); diff --git a/src/main/java/com/meetup/teame/backend/domain/user/controller/UserController.java b/src/main/java/com/meetup/teame/backend/domain/user/controller/UserController.java index 84f97c8..901de04 100644 --- a/src/main/java/com/meetup/teame/backend/domain/user/controller/UserController.java +++ b/src/main/java/com/meetup/teame/backend/domain/user/controller/UserController.java @@ -6,6 +6,7 @@ import com.meetup.teame.backend.domain.user.dto.request.ReadCalenderReq; import com.meetup.teame.backend.domain.user.dto.request.UpdateUserReq; import com.meetup.teame.backend.domain.user.dto.response.ReadCalenderRes; +import com.meetup.teame.backend.domain.user.dto.response.ReadExperienceProfileRes; import com.meetup.teame.backend.domain.user.dto.response.ReadMainRes; import com.meetup.teame.backend.domain.user.dto.response.UserInfoRes; import com.meetup.teame.backend.domain.user.service.UserService; @@ -63,11 +64,11 @@ public ResponseEntity setUserPersonality(@RequestBody @Valid OnboardingReq 임시로 고정된 더미 유저의 캘린더 정보를 조회하는 식으로 구현되어 있습니다. jwt토큰도 같이 전달해서 요청해주셔야 합니다. - + url 쿼리 파라미터로 다음과 같은 값을 전달해 주셔야 합니다. - + year : 년도 - + month : 월 """) @GetMapping("/mypage/calender") @@ -77,9 +78,9 @@ public ResponseEntity readCalender(@ModelAttribute @Valid ReadC } @Operation(summary = "사용자 기본 정보 조회", description = """ - + 사용자의 기본 정보를 볼 수 있는 api입니다. - + 추후 로그인 적용 시에는 jwt토큰도 같이 전달해서 요청해주셔야 합니다. """) //기본 정보 조회 @@ -91,7 +92,7 @@ public ResponseEntity getUserInfo() { @Operation(summary = "사용자 기본 정보 수정", description = """ 사용자의 기본 정보를 수정하는 api입니다. - + name, email, imageUrl, location 데이터를 받습니다. """) //기본 정보 수정 @@ -117,7 +118,7 @@ public ResponseEntity> getMyReviews(@RequestParam(required = f @Operation(summary = "내 활동 참여 목록 조회", description = """ 내 활동 참여 목록을 조회하는 api입니다. - + api 요청 시 보낼 데이터는 token 이외에 없습니다. """) @GetMapping("/activities") @@ -125,4 +126,10 @@ public ResponseEntity> getMyActivities() { List myActivities = userService.getMyActivities(); return ResponseEntity.ok().body(myActivities); } + + /* @PostMapping("/experience-profile") + public ResponseEntity createExperienceProfile() { + ReadExperienceProfileRes profile = userService.createExperienceProfile(); + return ResponseEntity.ok().body(profile); + }*/ } diff --git a/src/main/java/com/meetup/teame/backend/domain/user/dto/response/ReadCalenderRes.java b/src/main/java/com/meetup/teame/backend/domain/user/dto/response/ReadCalenderRes.java index 1288bb0..157d7da 100644 --- a/src/main/java/com/meetup/teame/backend/domain/user/dto/response/ReadCalenderRes.java +++ b/src/main/java/com/meetup/teame/backend/domain/user/dto/response/ReadCalenderRes.java @@ -1,12 +1,10 @@ package com.meetup.teame.backend.domain.user.dto.response; -import com.meetup.teame.backend.domain.chatroom.entity.Appointment; import com.meetup.teame.backend.domain.chatroom.entity.DirectChatRoom; import com.meetup.teame.backend.domain.chatroom.entity.GroupChatRoom; import lombok.*; import java.util.ArrayList; -import java.util.Collections; import java.util.List; @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/src/main/java/com/meetup/teame/backend/domain/user/dto/response/ReadExperienceProfileRes.java b/src/main/java/com/meetup/teame/backend/domain/user/dto/response/ReadExperienceProfileRes.java new file mode 100644 index 0000000..de61eed --- /dev/null +++ b/src/main/java/com/meetup/teame/backend/domain/user/dto/response/ReadExperienceProfileRes.java @@ -0,0 +1,26 @@ +package com.meetup.teame.backend.domain.user.dto.response; + +import lombok.*; + +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Builder +@Getter +public class ReadExperienceProfileRes { + + private Long id; + + private String name; + + private Long age; + + private String gender; + + private String location; + + private String area; + + private String introduce; + + +} diff --git a/src/main/java/com/meetup/teame/backend/domain/user/service/UserService.java b/src/main/java/com/meetup/teame/backend/domain/user/service/UserService.java index 258f7c8..24504c8 100644 --- a/src/main/java/com/meetup/teame/backend/domain/user/service/UserService.java +++ b/src/main/java/com/meetup/teame/backend/domain/user/service/UserService.java @@ -17,6 +17,7 @@ import com.meetup.teame.backend.domain.user.dto.request.ReadCalenderReq; import com.meetup.teame.backend.domain.user.dto.request.UpdateUserReq; import com.meetup.teame.backend.domain.user.dto.response.ReadCalenderRes; +import com.meetup.teame.backend.domain.user.dto.response.ReadExperienceProfileRes; import com.meetup.teame.backend.domain.user.dto.response.ReadMainRes; import com.meetup.teame.backend.domain.user.dto.response.UserInfoRes; import com.meetup.teame.backend.domain.user.entity.Gender; @@ -146,4 +147,11 @@ public ReadCalenderRes readCalender(ReadCalenderReq readCalenderReq) { groupChatRoomRepository.findAppointmentForUserInMonth(user, readCalenderReq.getYear(), readCalenderReq.getMonth()) ); } + + /*public ReadExperienceProfileRes createExperienceProfile() { + Long userId = SecurityContextProvider.getAuthenticatedUserId(); + User user = userRepository.findById(userId) + .orElseThrow(() -> new CustomException(ExceptionContent.NOT_FOUND_USER)); + + }*/ }