-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 친구 미션 목록 #196
feat: 친구 미션 목록 #196
Conversation
@Operation(summary = "친구 미션 목록 조회", description = "친구 미션 목록을 조회합니다.") | ||
@GetMapping("/follow") | ||
public FollowMissionFindAllResponse followMissionFindAll( | ||
@RequestParam("nickname") String nickname) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetMapping일 경우 PathVariable과 RequestParam은 각각 어떤 차이를 가지고있고,
해당 경우에서는 RequestParam을 사용하신 이유가 궁금해요 👀
// 번개 stack 누적 메서드 | ||
public long symbolStackCalculate(List<MissionRecord> missionRecords) { | ||
return missionRecords.stream() | ||
.mapToLong(missionRecord -> missionRecord.getDuration().toMinutes() / 10) | ||
.sum(); | ||
} | ||
|
||
// 업로드 완료 미션 기록 리스트 | ||
public List<MissionRecord> findCompletedMissionRecords(List<Mission> missions) { | ||
return missions.stream() | ||
.flatMap(mission -> mission.getMissionRecords().stream()) | ||
.filter( | ||
missionRecord -> | ||
missionRecord.getUploadStatus() == ImageUploadStatus.COMPLETE) | ||
.toList(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메소드 분리 좋습니당 👍🏻👍🏻
final Member followingMember = memberUtil.getMemberByNickname(nickname); | ||
final Member currentMember = memberUtil.getCurrentMember(); | ||
final LocalDate today = LocalDate.now(); | ||
|
||
boolean existMemberRelation = | ||
memberRelationRepository.existsByFollowerIdAndFollowingId( | ||
currentMember.getId(), followingMember.getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- feat: 나와 타인의 팔로우/팔로잉 카운트 조회 #199 PR에서 MemberRelation 필드명 target, source로 변경되었으니 참고 부탁드립니당
boolean existMemberRelation = | ||
memberRelationRepository.existsByFollowerIdAndFollowingId( | ||
currentMember.getId(), followingMember.getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요 부분 논의가 좀 필요할 것 같아요.
해당 API가 추 후에 회원 검색이 존재하고 재사용한다면 괜찮을 것 같은데,
지금은 홈 화면에서 친구
의 경우만 정보를 조회하고 있으니 existMemberRelation가 false가 된다면
친구인 회원만 미션 목록을 조회할 수 있습니다
와 같은 에러처리가 필요할 것 같아요.
private BooleanExpression visibilityByRelations(boolean existsRelations) { | ||
return existsRelations | ||
? mission.visibility.in(MissionVisibility.FOLLOWER, MissionVisibility.ALL) | ||
: mission.visibility.in(MissionVisibility.ALL); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A유저(로그인한 유저)가 B유저(친구)의 미션 목록을 조회한다고 하였을 때,
B가 미션을 Follow에게 공개로 올려놓고, B는 A를 팔로우하지 않았을 때 공개되지 않아야 될 것 같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그럼 완전히 맞팔 관계에서만 Follow 공개 여부를 결정하는 건가용??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 저는 그렇게 이해했는데 기획 확인 해보셔야 할 것 같아요!
현재로선 A유저가 B유저를 팔로우하지 않는다면,
B유저의 정보를 볼 수 있는 페이지가 존재하지 않아서 현재로서는 그럴 것 같아요
(추 후 유저 닉네임 검색 서비스가 생겨서 A유저가 B유저를 팔로우하지 않아도 미션목록 조회가 가능한다고 가정하면, 이때는 A유저가 B유저를 팔로우하지 않았을 때 B유저가 공개여부를 Follow로 올린 미션은 보이지 않는 경우 생김)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
기획 상 B유저가 Follow 공개로 올린 미션은 B유저가 A유저를 팔로우하지 않더라도
A가 B를 팔로우했을 때 A에게 보여져야 한다고 들었는데,
Service 로직
boolean existMemberRelation =
memberRelationRepository.existsBySourceIdAndTargetId(
followingMember.getId(), currentMember.getId());
부분에서 B유저가 A유저를 팔로우하고있는지를 체크하고있어서 요 부분 수정해야하지 않을까 싶은데 어떻게 생각하세염?
제가 잘못 이해한건지 하고 질문드립니다!
public static FollowMissionFindAllResponse from( | ||
long symbolStack, List<MissionFindAllResponse> followMissions) { | ||
return new FollowMissionFindAllResponse(symbolStack, followMissions); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
정적 팩토리 메서드 네이밍 규칙에 따라 from보다는 다른 네이밍을 사용하는게 좋다고 생각함니당
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아티클 감사합니당!
public static MissionFindAllResponse from(Mission mission, MissionStatus missionStatus) { | ||
return new MissionFindAllResponse( | ||
mission.getId(), | ||
mission.getName(), | ||
mission.getContent(), | ||
mission.getCategory(), | ||
mission.getVisibility(), | ||
mission.getDurationStatus(), | ||
mission.getArchiveStatus(), | ||
mission.getSort(), | ||
missionStatus, | ||
null, | ||
null); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null 전파를 객체 내부까지 넘어가게 된다면 관리하기 위한 포인트가 많아진다. 라는 이야기를 재현님이랑 했었는데
이거에 대한 의견도 궁금합니다. (지난번에 미션 리스트 조회
에서는 의도한대로 null을 넣는게 맞기때문에 Service 레이어에서 null을 넣어주고있음)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
차라리 DTO를 하나 더 생성하는 게 나을까용??
final Member followingMember = memberUtil.getMemberByNickname(nickname); | ||
final Member currentMember = memberUtil.getCurrentMember(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
targetMember SourceMember라는 네이밍을 쓰는게 좋을 것 같아용
private BooleanExpression visibilityByRelations(boolean existsRelations) { | ||
return existsRelations | ||
? mission.visibility.in(MissionVisibility.FOLLOWER, MissionVisibility.ALL) | ||
: mission.visibility.in(MissionVisibility.ALL); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
기획 상 B유저가 Follow 공개로 올린 미션은 B유저가 A유저를 팔로우하지 않더라도
A가 B를 팔로우했을 때 A에게 보여져야 한다고 들었는데,
Service 로직
boolean existMemberRelation =
memberRelationRepository.existsBySourceIdAndTargetId(
followingMember.getId(), currentMember.getId());
부분에서 B유저가 A유저를 팔로우하고있는지를 체크하고있어서 요 부분 수정해야하지 않을까 싶은데 어떻게 생각하세염?
제가 잘못 이해한건지 하고 질문드립니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨슴니당
|
🌱 관련 이슈
📌 작업 내용 및 특이사항
📝 참고사항
📚 기타