From b6da492bae1388bced609dbe1d712fc2e8d409fa Mon Sep 17 00:00:00 2001 From: jeongwpa <55525927+yhames@users.noreply.github.com> Date: Fri, 30 Aug 2024 16:34:35 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20[Refactoring]=20Agenda=20History?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=EC=8B=9C=20CONFIRM=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20#988=20(#990)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gg/agenda/api/user/agenda/service/AgendaService.java | 2 +- .../gg/agenda/api/user/agenda/service/AgendaServiceTest.java | 5 +++-- gg-repo/src/main/java/gg/repo/agenda/AgendaRepository.java | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gg-agenda-api/src/main/java/gg/agenda/api/user/agenda/service/AgendaService.java b/gg-agenda-api/src/main/java/gg/agenda/api/user/agenda/service/AgendaService.java index a8b3328d5..91cde141c 100644 --- a/gg-agenda-api/src/main/java/gg/agenda/api/user/agenda/service/AgendaService.java +++ b/gg-agenda-api/src/main/java/gg/agenda/api/user/agenda/service/AgendaService.java @@ -96,7 +96,7 @@ public Agenda addAgenda(AgendaCreateReqDto createDto, MultipartFile agendaPoster @Transactional(readOnly = true) public Page findHistoryAgendaList(Pageable pageable) { - return agendaRepository.findAllByStatusIs(AgendaStatus.FINISH, pageable); + return agendaRepository.findAllByStatusIs(AgendaStatus.FINISH, AgendaStatus.CONFIRM, pageable); } @Transactional diff --git a/gg-agenda-api/src/test/java/gg/agenda/api/user/agenda/service/AgendaServiceTest.java b/gg-agenda-api/src/test/java/gg/agenda/api/user/agenda/service/AgendaServiceTest.java index 1461a2149..8989c0742 100644 --- a/gg-agenda-api/src/test/java/gg/agenda/api/user/agenda/service/AgendaServiceTest.java +++ b/gg-agenda-api/src/test/java/gg/agenda/api/user/agenda/service/AgendaServiceTest.java @@ -191,7 +191,8 @@ void getAgendaListHistorySuccess() { .build() )); Page agendaPage = new PageImpl<>(agendas.subList(0, 10), pageable, size); - when(agendaRepository.findAllByStatusIs(eq(AgendaStatus.FINISH), any(Pageable.class))) + when(agendaRepository.findAllByStatusIs( + eq(AgendaStatus.FINISH), eq(AgendaStatus.CONFIRM), any(Pageable.class))) .thenReturn(agendaPage); // when @@ -200,7 +201,7 @@ void getAgendaListHistorySuccess() { // then verify(agendaRepository, times(1)) - .findAllByStatusIs(AgendaStatus.FINISH, pageable); + .findAllByStatusIs(AgendaStatus.FINISH, AgendaStatus.CONFIRM, pageable); assertThat(result.size()).isEqualTo(size); for (int i = 1; i < result.size(); i++) { assertThat(result.get(i).getStartTime()) diff --git a/gg-repo/src/main/java/gg/repo/agenda/AgendaRepository.java b/gg-repo/src/main/java/gg/repo/agenda/AgendaRepository.java index d0d678b26..552f498e0 100644 --- a/gg-repo/src/main/java/gg/repo/agenda/AgendaRepository.java +++ b/gg-repo/src/main/java/gg/repo/agenda/AgendaRepository.java @@ -20,7 +20,8 @@ public interface AgendaRepository extends JpaRepository { @Query("SELECT a FROM Agenda a WHERE a.status = :status") List findAllByStatusIs(AgendaStatus status); - Page findAllByStatusIs(AgendaStatus status, Pageable pageable); + @Query("SELECT a FROM Agenda a WHERE a.status = :status1 OR a.status = :status2") + Page findAllByStatusIs(AgendaStatus status1, AgendaStatus status2, Pageable pageable); Optional findAgendaByAgendaKey(UUID usedTo);