Skip to content

Commit

Permalink
feat: FindDetailInfoResult, UserProfileDetailInfo에 user 프로필 정보를 추가한다. (
Browse files Browse the repository at this point in the history
  • Loading branch information
min429 authored Aug 8, 2024
1 parent 3d447a3 commit 297a0f6
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package com.dnd.accompany.domain.accompany.api.dto;

import java.time.LocalDateTime;
import java.util.List;

import com.dnd.accompany.domain.accompany.entity.enums.Category;
import com.dnd.accompany.domain.accompany.entity.enums.PreferredAge;
import com.dnd.accompany.domain.accompany.entity.enums.PreferredGender;
import com.dnd.accompany.domain.accompany.entity.enums.Region;
import com.dnd.accompany.domain.user.entity.enums.FoodPreference;
import com.dnd.accompany.domain.user.entity.enums.Gender;
import com.dnd.accompany.domain.user.entity.enums.TravelPreference;
import com.dnd.accompany.domain.user.entity.enums.TravelStyle;

public record FindDetailInfoResult(
Long boardId,
Expand All @@ -19,6 +24,12 @@ public record FindDetailInfoResult(
Category category,
PreferredAge preferredAge,
PreferredGender preferredGender,
String nickname
String nickname,
String provider,
Gender gender,
List<TravelPreference> travelPreferences,
List<TravelStyle> travelStyles,
List<FoodPreference> foodPreferences
// List<UserImages> 추가 예정
) {
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
package com.dnd.accompany.domain.accompany.api.dto;

import java.util.List;

import com.dnd.accompany.domain.user.entity.enums.FoodPreference;
import com.dnd.accompany.domain.user.entity.enums.Gender;
import com.dnd.accompany.domain.user.entity.enums.TravelPreference;
import com.dnd.accompany.domain.user.entity.enums.TravelStyle;

import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -9,9 +16,22 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class UserProfileDetailInfo {
private String nickname;
private String provider;
private Gender gender;
private List<TravelPreference> travelPreferences;
private List<TravelStyle> travelStyles;
private List<FoodPreference> foodPreferences;
// List<UserImages> 추가 예정

@Builder
public UserProfileDetailInfo(String nickname) {
public UserProfileDetailInfo(String nickname, String provider, Gender gender,
List<TravelPreference> travelPreferences,
List<TravelStyle> travelStyles, List<FoodPreference> foodPreferences) {
this.nickname = nickname;
this.provider = provider;
this.gender = gender;
this.travelPreferences = travelPreferences;
this.travelStyles = travelStyles;
this.foodPreferences = foodPreferences;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static com.dnd.accompany.domain.accompany.entity.QAccompanyUser.*;
import static com.dnd.accompany.domain.accompany.entity.enums.Role.*;
import static com.dnd.accompany.domain.user.entity.QUser.*;
import static com.dnd.accompany.domain.user.entity.QUserProfile.*;

import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -76,11 +77,17 @@ public Optional<FindDetailInfoResult> findDetailInfo(Long boardId) {
accompanyBoard.category,
accompanyBoard.preferredAge,
accompanyBoard.preferredGender,
user.nickname))
user.nickname,
user.provider,
userProfile.gender,
userProfile.travelPreferences,
userProfile.travelStyles,
userProfile.foodPreferences))
.from(accompanyBoard)
.leftJoin(accompanyUser).on(accompanyUser.accompanyBoard.id.eq(accompanyBoard.id)
.and(isHost()))
.leftJoin(user).on(user.id.eq(accompanyUser.user.id))
.leftJoin(userProfile).on(userProfile.userId.eq(user.id))
.where(accompanyBoard.id.eq(boardId))
.fetchOne();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ public void delete(Long userId, Long boardId) {
private static UserProfileDetailInfo getUserProfileDetailInfo(FindDetailInfoResult detailInfo) {
return UserProfileDetailInfo.builder()
.nickname(detailInfo.nickname())
.provider(detailInfo.provider())
.gender(detailInfo.gender())
.travelPreferences(detailInfo.travelPreferences())
.travelStyles(detailInfo.travelStyles())
.foodPreferences(detailInfo.foodPreferences())
.build();
}

Expand Down

0 comments on commit 297a0f6

Please sign in to comment.