From 8acd931c59de6e69dfa061eda9d73eac88260c3e Mon Sep 17 00:00:00 2001 From: minsu20 Date: Mon, 13 Nov 2023 22:50:18 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=86=8C=EB=AA=A8=EC=9E=84=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=ED=95=A0=20=EB=95=8C=20=EC=82=AD=EC=A0=9C=EB=90=9C=20?= =?UTF-8?q?=EA=B2=83=EB=8F=84=20=EC=A1=B0=ED=9A=8C=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/repository/TeamCustomRepositoryImpl.java | 10 ++++------ .../domain/team/domain/service/TeamGetService.java | 2 +- .../com/moing/backend/global/util/StartupRunner.java | 7 +++++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/moing/backend/domain/team/domain/repository/TeamCustomRepositoryImpl.java b/src/main/java/com/moing/backend/domain/team/domain/repository/TeamCustomRepositoryImpl.java index 8fa7606e..3b170f51 100644 --- a/src/main/java/com/moing/backend/domain/team/domain/repository/TeamCustomRepositoryImpl.java +++ b/src/main/java/com/moing/backend/domain/team/domain/repository/TeamCustomRepositoryImpl.java @@ -36,7 +36,6 @@ public GetTeamResponse findTeamByMemberId(Long memberId) { @Override public Optional 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) // 강제종료되지 않았거나 @@ -78,7 +77,7 @@ public List findMyPageTeamByMemberId(Long memberId) { private List getTeamBlock(Long memberId) { LocalDateTime threeDaysAgo = LocalDateTime.now().minusDays(3); - + return queryFactory .select(new QTeamBlock(team.teamId, team.approvalTime, @@ -90,10 +89,9 @@ private List 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(); diff --git a/src/main/java/com/moing/backend/domain/team/domain/service/TeamGetService.java b/src/main/java/com/moing/backend/domain/team/domain/service/TeamGetService.java index e5583318..980bca98 100644 --- a/src/main/java/com/moing/backend/domain/team/domain/service/TeamGetService.java +++ b/src/main/java/com/moing/backend/domain/team/domain/service/TeamGetService.java @@ -28,7 +28,7 @@ public List getTeamIdByMemberId(Long memberId) { } public Team getTeamByTeamId(Long teamId){ - return teamRepository.findTeamByTeamId(teamId).orElseThrow(()->new NotFoundByTeamIdException()); + return teamRepository.findTeamByTeamId(teamId).orElseThrow(NotFoundByTeamIdException::new); } public List getMyPageTeamBlockByMemberId(Long memberId){ diff --git a/src/main/java/com/moing/backend/global/util/StartupRunner.java b/src/main/java/com/moing/backend/global/util/StartupRunner.java index de40dc56..5fa2b867 100644 --- a/src/main/java/com/moing/backend/global/util/StartupRunner.java +++ b/src/main/java/com/moing/backend/global/util/StartupRunner.java @@ -32,5 +32,12 @@ public void run(String... args) throws Exception { Member test03=new Member(LocalDate.now(), "tester3@test.com", "undef", Gender.WOMAN, "undef", "modagbul_tester3", "undef", SocialProvider.APPLE, RegistrationStatus.COMPLETED, Role.USER, "APPLE@tester03"); memberSaveService.saveMember(test03); + + Member test04=new Member(LocalDate.now(), "tester4@test.com", "undef", Gender.WOMAN, "undef", "modagbul_tester4", "undef", SocialProvider.APPLE, RegistrationStatus.COMPLETED, Role.USER, "APPLE@tester04"); + memberSaveService.saveMember(test04); + + Member test05=new Member(LocalDate.now(), "tester5@test.com", "undef", Gender.WOMAN, "undef", "modagbul_tester5", "undef", SocialProvider.APPLE, RegistrationStatus.COMPLETED, Role.USER, "APPLE@tester05"); + memberSaveService.saveMember(test05); + } }