Skip to content

Commit

Permalink
[�SPR-166] 숏츠 프로필바 수정
Browse files Browse the repository at this point in the history
* [SPR-166] 숏츠 프로필바 response 수정

* [SPR-166] import문 정리
  • Loading branch information
gourderased authored Feb 15, 2024
1 parent 297b3d8 commit 0d3e8de
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,15 @@ public List<ShortsProfileSimpleInfo> getShortsProfileList(User user) {
currentUserId);
List<ShortsProfileSimpleInfo> shortsProfileSimpleInfos = followingUserList.stream()
.map(followRelationship -> {

Long gymId = null;
Boolean isGym = followRelationship.getFollowing() instanceof Manager;
if(isGym) {
gymId = ((Manager) followRelationship.getFollowing()).getClimbingGym().getId();
}

return ShortsProfileSimpleInfo.toDTO(followRelationship.getFollowing(),
followRelationship);
followRelationship, isGym, gymId);
}).toList();

return shortsProfileSimpleInfos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.climeet.climeet_backend.domain.shorts.dto;

import com.climeet.climeet_backend.domain.climbinggym.ClimbingGym;
import com.climeet.climeet_backend.domain.difficultymapping.DifficultyMapping;
import com.climeet.climeet_backend.domain.followrelationship.FollowRelationship;
import com.climeet.climeet_backend.domain.sector.Sector;
import com.climeet.climeet_backend.domain.shorts.Shorts;
Expand Down Expand Up @@ -118,13 +117,18 @@ public static class ShortsProfileSimpleInfo {
private String followingUserName;
private String followingUserProfileUrl;
private Boolean isUploadRecent;
private Boolean isGym;
private Long gymId;

public static ShortsProfileSimpleInfo toDTO(User user,
FollowRelationship followRelationship) {
FollowRelationship followRelationship, Boolean isGym, Long gymId) {
return ShortsProfileSimpleInfo.builder().followingUserId(user.getId())
.followingUserName(user.getProfileName())
.followingUserProfileUrl(user.getProfileImageUrl())
.isUploadRecent(followRelationship.getIsUploadShortsRecent()).build();
.isUploadRecent(followRelationship.getIsUploadShortsRecent())
.isGym(isGym)
.gymId(gymId)
.build();

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static ShortsComment toEntity(User user, CreateShortsCommentRequest creat
.build();
}

public void updateIsPrentFalse() {
public void updateIsParentFalse() {
this.isParent = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ public ShortsCommentParentResponse createShortsComment(User user, Long shortsId,
ShortsComment parentComment = shortsCommentRepository.findById(parentCommentId)
.orElseThrow(() -> new GeneralException(ErrorStatus._EMPTY_SHORTS_COMMENT));

if(parentComment.getChildCommentCount() != 0) {
shortsComment.updateIsFirstChildFalse();
}
parentComment.updateChildCommentCount();
shortsComment.updateIsFirstChildFalse();
shortsComment.updateParentComment(parentComment);
shortsComment.updateIsPrentFalse();
shortsComment.updateIsParentFalse();
}

shortsCommentRepository.save(shortsComment);
Expand Down

0 comments on commit 0d3e8de

Please sign in to comment.