From 9131c9f756f4eaf6716482be78b100ff98330476 Mon Sep 17 00:00:00 2001 From: yang Date: Fri, 15 Mar 2024 00:39:03 +0900 Subject: [PATCH 1/2] =?UTF-8?q?RAC-325=20hotFix=20:=20=ED=9B=84=EB=B0=B0?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EC=84=A0=EB=B0=B0=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EC=95=88=EB=90=98=EB=8A=94=20=EC=98=A4=EB=A5=98=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../senior/application/usecase/SeniorInfoUseCase.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorInfoUseCase.java b/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorInfoUseCase.java index adfa9935..bff50863 100644 --- a/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorInfoUseCase.java +++ b/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorInfoUseCase.java @@ -20,6 +20,7 @@ import static com.postgraduate.domain.senior.application.mapper.SeniorMapper.mapToSeniorDetail; import static com.postgraduate.domain.senior.application.mapper.SeniorMapper.mapToSeniorProfile; +import static com.postgraduate.domain.user.domain.entity.constant.Role.SENIOR; @Service @Transactional @@ -30,7 +31,7 @@ public class SeniorInfoUseCase { private final AvailableGetService availableGetService; public SeniorDetailResponse getSeniorDetail(User user, Long seniorId) { - if (user != null) + if (user != null && user.getRole() == SENIOR) return checkIsMine(user, seniorId); return getResponse(seniorId, false); } @@ -99,9 +100,4 @@ public AllSeniorIdResponse getAllSeniorId() { .toList(); return new AllSeniorIdResponse(seniorIds); } - - public Long getSeniorId(String nickName) { - Senior senior = seniorGetService.bySeniorNickName(nickName); - return senior.getSeniorId(); - } } From f0057f893899efcc775f4dbb93ead6ce2d6eb889 Mon Sep 17 00:00:00 2001 From: yang Date: Fri, 15 Mar 2024 00:54:46 +0900 Subject: [PATCH 2/2] =?UTF-8?q?RAC-325=20test=20:=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../senior/application/usecase/SeniorInfoUseCaseTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/postgraduate/domain/senior/application/usecase/SeniorInfoUseCaseTest.java b/src/test/java/com/postgraduate/domain/senior/application/usecase/SeniorInfoUseCaseTest.java index 51d96210..0df79663 100644 --- a/src/test/java/com/postgraduate/domain/senior/application/usecase/SeniorInfoUseCaseTest.java +++ b/src/test/java/com/postgraduate/domain/senior/application/usecase/SeniorInfoUseCaseTest.java @@ -30,6 +30,7 @@ import static java.lang.Boolean.TRUE; import static java.time.LocalDate.now; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; @ExtendWith(MockitoExtension.class) @@ -64,14 +65,14 @@ void setting() { LocalDateTime.now(), LocalDateTime.now()); } @Test - @DisplayName("선배 상세보기 테스트") + @DisplayName("선배 상세보기 테스트 USER") void getSeniorDetail() { Available available1 = new Available(1L, "월", "12:00", "18:00", senior); Available available2 = new Available(2L, "화", "12:00", "18:00", senior); Available available3 = new Available(3L, "수", "12:00", "18:00", senior); List availables = List.of(available1, available2, available3); - given(seniorGetService.byUser(user)) + given(seniorGetService.bySeniorIdWithCertification(any())) .willReturn(senior); given(availableGetService.bySenior(senior)) .willReturn(availables);