Skip to content

Commit

Permalink
Feat: 유저 온보딩 정보 조히 api
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeongho427 committed May 23, 2024
1 parent cb674cd commit 6655a0e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ public ResponseEntity<Void> setUserPersonality(@RequestBody @Valid OnboardingReq
.ok().build();
}

@Operation(summary = "유저 온보딩 정보 조회", description = """
user 온보딩 정보 조회 api입니다.
토큰을 넘겨주시면 토큰에 해당하는 유저의 온보딩 정보를 반환해줍니다.
""")
@GetMapping("/personalities")
public ResponseEntity<UserOnboardingRes> getUserPersonalities() {
UserOnboardingRes response = userService.getUserPersonalities();
return ResponseEntity.ok().body(response);
}


@Operation(summary = "마이페이지 캘린더 조회", description = """
유저의 캘린더 정보를 조회합니다.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.meetup.teame.backend.domain.user.dto.response;

import com.meetup.teame.backend.domain.personality.Personality;
import com.meetup.teame.backend.domain.user.entity.User;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@NoArgsConstructor
@AllArgsConstructor
@Getter
@Builder
public class UserOnboardingRes {

private List<String> personalities = new ArrayList<>();

public static UserOnboardingRes of(User user) {
List<String> personalityDescriptions = user.getPersonalities().stream()
.map(Personality::getDescription)
.collect(Collectors.toList());

return UserOnboardingRes.builder()
.personalities(personalityDescriptions)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ public void setUserPersonality(OnboardingReq onboardingReq) {
user.setPersonalities(personalities);
}

public UserOnboardingRes getUserPersonalities() {
Long userId = SecurityContextProvider.getAuthenticatedUserId();
User user = userRepository.findById(userId)
.orElseThrow(() -> new CustomException(ExceptionContent.NOT_FOUND_USER));

return UserOnboardingRes.of(user);
}

public ReadCalenderRes readCalender(ReadCalenderReq readCalenderReq) {
Long userId = SecurityContextProvider.getAuthenticatedUserId();
User user = userRepository.findById(userId)
Expand Down

0 comments on commit 6655a0e

Please sign in to comment.