Skip to content

Commit

Permalink
Merge pull request #26 from Leets-Official/fix/#25/유저-정보-response-오류
Browse files Browse the repository at this point in the history
[fix] #25 유저정보 반환 KEY 값 수정
  • Loading branch information
ehs208 authored Nov 13, 2024
2 parents ea3b662 + 28d3ae8 commit 3da0541
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.leets.xcellentbe.domain.user.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.leets.xcellentbe.domain.user.domain.User;

import lombok.Builder;
Expand All @@ -24,18 +23,14 @@ public class UserProfileResponseDto {
private int userBirthDay;
private int followersCount;
private int followingsCount;

@JsonProperty("isFollowing")
private boolean isFollowing;

@JsonProperty("isMyProfile")
private boolean isMyProfile;
private Boolean isFollowing;
private Boolean isMyProfile;

@Builder
private UserProfileResponseDto(String email, String customId, String userName, String profileImageUrl,
String backgroundProfileImageUrl, String phoneNumber, String description, String websiteUrl, String location,
int userBirthYear, int userBirthMonth, int userBirthDay, int followersCount, int followingsCount,
boolean isFollowing, boolean isMyProfile) {
Boolean isFollowing, Boolean isMyProfile) {
this.email = email;
this.customId = customId;
this.userName = userName;
Expand All @@ -54,8 +49,8 @@ private UserProfileResponseDto(String email, String customId, String userName, S
this.isFollowing = isFollowing;
}

public static UserProfileResponseDto from(User user, int followersCount, int followingsCount, boolean isFollowing,
boolean isMyProfile) {
public static UserProfileResponseDto from(User user, int followersCount, int followingsCount, Boolean isFollowing,
Boolean isMyProfile) {
return UserProfileResponseDto.builder()
.email(user.getEmail())
.customId(user.getCustomId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public UserProfileResponseDto getProfile(HttpServletRequest request) {

int followerCount = followRepository.countByFollowing(user);
int followingCount = followRepository.countByFollower(user);

return UserProfileResponseDto.from(user, followerCount, followingCount, false, true);
}

Expand All @@ -66,8 +66,8 @@ public UserProfileResponseDto getProfileWithoutToken(String customId, HttpServle
User myinfo = getUser(request);
User user = userRepository.findByCustomId(customId).orElseThrow(UserNotFoundException::new);

boolean isMyProfile = myinfo.equals(user);
boolean isFollowing = followRepository.findByFollowerAndFollowing(myinfo, user).isPresent();
Boolean isMyProfile = myinfo.equals(user);
Boolean isFollowing = followRepository.findByFollowerAndFollowing(myinfo, user).isPresent();

int followerCount = followRepository.countByFollowing(user);
int followingCount = followRepository.countByFollower(user);
Expand Down

0 comments on commit 3da0541

Please sign in to comment.