Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
minsu20 committed Nov 13, 2023
2 parents b0194f2 + bf01288 commit 26fd3f2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public GetTeamResponse findTeamByMemberId(Long memberId) {
@Override
public Optional<Team> findTeamByTeamId(Long teamId) {
LocalDateTime threeDaysAgo = LocalDateTime.now().minusDays(3);

return Optional.ofNullable(queryFactory.selectFrom(team)
.where(team.teamId.eq(teamId))
.where(team.isDeleted.eq(false) // 강제종료되지 않았거나
Expand Down Expand Up @@ -78,7 +77,7 @@ public List<GetMyPageTeamBlock> findMyPageTeamByMemberId(Long memberId) {

private List<TeamBlock> getTeamBlock(Long memberId) {
LocalDateTime threeDaysAgo = LocalDateTime.now().minusDays(3);

return queryFactory
.select(new QTeamBlock(team.teamId,
team.approvalTime,
Expand All @@ -90,10 +89,9 @@ private List<TeamBlock> getTeamBlock(Long memberId) {
.from(teamMember)
.innerJoin(teamMember.team, team)
.on(teamMember.member.memberId.eq(memberId))
.where(teamMember.isDeleted.eq(false)) // 탈퇴하지 않았다면
.where(team.isDeleted.eq(false) // 강제종료되지 않았거나
.or(team.deletionTime.isNotNull()
.or(team.deletionTime.after(threeDaysAgo)))) // 강제종료된 경우 3일이 지나지 않았다면
.where(teamMember.isDeleted.eq(false)// 탈퇴하지 않았다면
.and(team.isDeleted.eq(false) // 강제종료되지 않았거나
.or(team.deletionTime.after(threeDaysAgo))))// 강제종료된 경우 3일이 지나지 않았다면
.orderBy(team.approvalTime.asc())
.groupBy(team.teamId)
.fetch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public List<Long> getTeamIdByMemberId(Long memberId) {
}

public Team getTeamByTeamId(Long teamId){
return teamRepository.findTeamByTeamId(teamId).orElseThrow(()->new NotFoundByTeamIdException());
return teamRepository.findTeamByTeamId(teamId).orElseThrow(NotFoundByTeamIdException::new);
}

public List<GetMyPageTeamBlock> getMyPageTeamBlockByMemberId(Long memberId){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,12 @@ public void run(String... args) throws Exception {

Member test03=new Member(LocalDate.now(), "[email protected]", "undef", Gender.WOMAN, "undef", "modagbul_tester3", "undef", SocialProvider.APPLE, RegistrationStatus.COMPLETED, Role.USER, "APPLE@tester03");
memberSaveService.saveMember(test03);

Member test04=new Member(LocalDate.now(), "[email protected]", "undef", Gender.WOMAN, "undef", "modagbul_tester4", "undef", SocialProvider.APPLE, RegistrationStatus.COMPLETED, Role.USER, "APPLE@tester04");
memberSaveService.saveMember(test04);

Member test05=new Member(LocalDate.now(), "[email protected]", "undef", Gender.WOMAN, "undef", "modagbul_tester5", "undef", SocialProvider.APPLE, RegistrationStatus.COMPLETED, Role.USER, "APPLE@tester05");
memberSaveService.saveMember(test05);

}
}

0 comments on commit 26fd3f2

Please sign in to comment.