From bad961fabbdd9b34fe936612151cbab585f86c1a Mon Sep 17 00:00:00 2001 From: yang Date: Tue, 5 Mar 2024 20:03:59 +0900 Subject: [PATCH 1/3] =?UTF-8?q?RAC-304=20fix=20:=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=95=84=20=EB=AF=B8=EC=99=84=EC=84=B1=20=EC=84=A0=EB=B0=B0=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/repository/SeniorDslRepositoryImpl.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/postgraduate/domain/senior/domain/repository/SeniorDslRepositoryImpl.java b/src/main/java/com/postgraduate/domain/senior/domain/repository/SeniorDslRepositoryImpl.java index 8fe863a8..0867204e 100644 --- a/src/main/java/com/postgraduate/domain/senior/domain/repository/SeniorDslRepositoryImpl.java +++ b/src/main/java/com/postgraduate/domain/senior/domain/repository/SeniorDslRepositoryImpl.java @@ -43,7 +43,8 @@ public Page findAllBySearchSenior(String search, String sort, Pageable p .where( senior.info.totalInfo.like("%" + search + "%"), senior.status.eq(APPROVE), - senior.user.isDelete.eq(FALSE) + senior.user.isDelete.eq(FALSE), + senior.profile.isNotNull() ) .orderBy(orderSpecifier(sort)) .orderBy(senior.user.nickName.asc()). @@ -84,7 +85,8 @@ public Page findAllByFieldSenior(String field, String postgradu, Pageabl fieldSpecifier(field), postgraduSpecifier(postgradu), senior.status.eq(APPROVE), - senior.user.isDelete.eq(FALSE) + senior.user.isDelete.eq(FALSE), + senior.profile.isNotNull() ) .orderBy(senior.hit.desc()) .orderBy(senior.user.nickName.asc()) @@ -170,7 +172,8 @@ public Page findAllBySearchSeniorWithAdmin(String search, Pageable pagea private BooleanExpression searchLike(String search) { if (StringUtils.hasText(search)) { return senior.user.phoneNumber.contains(search) - .or(senior.user.nickName.contains(search)); + .or(senior.user.nickName.contains(search)) + .and(senior.profile.isNotNull()); } return null; } @@ -184,8 +187,8 @@ public Optional findBySeniorId(Long seniorId) { .where( senior.seniorId.eq(seniorId), senior.profile.isNotNull(), - senior.status.eq(APPROVE) - ,senior.user.isDelete.isFalse() + senior.status.eq(APPROVE), + senior.user.isDelete.isFalse() ) .fetchOne()); } From f8643511e194382f334aab75f2835d453675aa39 Mon Sep 17 00:00:00 2001 From: yang Date: Tue, 5 Mar 2024 21:12:33 +0900 Subject: [PATCH 2/3] =?UTF-8?q?RAC-304=20test=20:=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/senior/presentation/SeniorControllerTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/postgraduate/domain/senior/presentation/SeniorControllerTest.java b/src/test/java/com/postgraduate/domain/senior/presentation/SeniorControllerTest.java index 25b4e4fa..f25e4d80 100644 --- a/src/test/java/com/postgraduate/domain/senior/presentation/SeniorControllerTest.java +++ b/src/test/java/com/postgraduate/domain/senior/presentation/SeniorControllerTest.java @@ -86,11 +86,13 @@ void setUp() throws IOException { userRepository.save(otherUser); Info info1 = new Info("major", "postgradu", "교수님", "keyword1,keyword2", "랩실", "field", false, false, "field,keyword1,keyword2"); - senior = new Senior(0L, user, "certification", Status.APPROVE, 0, info1, null, now(), now()); + Profile profile1 = new Profile("info", "one", "u", "chat", 30); + senior = new Senior(0L, user, "certification", Status.APPROVE, 0, info1, profile1, now(), now()); seniorRepository.save(senior); Info info2 = new Info("major", "postgradu", "교수님", "keyword1,keyword2", "랩실", "field", false, false, "field,keyword1,keyword2"); - otherSenior = new Senior(-1L, otherUser, "certification", Status.APPROVE, 0, info2, null, now(), now()); + Profile profile2 = new Profile("info", "one", "u", "chat", 30); + otherSenior = new Senior(-1L, otherUser, "certification", Status.APPROVE, 0, info2, profile2, now(), now()); seniorRepository.save(otherSenior); token = jwtUtil.generateAccessToken(user.getUserId(), Role.SENIOR); From f201f55068cb4632e1f690af168f926982668d82 Mon Sep 17 00:00:00 2001 From: yang Date: Tue, 5 Mar 2024 21:27:13 +0900 Subject: [PATCH 3/3] =?UTF-8?q?RAC-304=20test=20:=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../senior/presentation/SeniorControllerTest.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/test/java/com/postgraduate/domain/senior/presentation/SeniorControllerTest.java b/src/test/java/com/postgraduate/domain/senior/presentation/SeniorControllerTest.java index f25e4d80..ece47bc6 100644 --- a/src/test/java/com/postgraduate/domain/senior/presentation/SeniorControllerTest.java +++ b/src/test/java/com/postgraduate/domain/senior/presentation/SeniorControllerTest.java @@ -74,7 +74,8 @@ class SeniorControllerTest extends IntegrationTest { private Senior senior; private Senior otherSenior; private String token; - private String otherToken; + private String seniorToken; + private String userToken; private User user; private User otherUser; @@ -91,12 +92,12 @@ void setUp() throws IOException { seniorRepository.save(senior); Info info2 = new Info("major", "postgradu", "교수님", "keyword1,keyword2", "랩실", "field", false, false, "field,keyword1,keyword2"); - Profile profile2 = new Profile("info", "one", "u", "chat", 30); - otherSenior = new Senior(-1L, otherUser, "certification", Status.APPROVE, 0, info2, profile2, now(), now()); + otherSenior = new Senior(-1L, otherUser, "certification", Status.APPROVE, 0, info2, null, now(), now()); seniorRepository.save(otherSenior); token = jwtUtil.generateAccessToken(user.getUserId(), Role.SENIOR); - otherToken = jwtUtil.generateAccessToken(otherUser.getUserId(), Role.USER); + seniorToken = jwtUtil.generateAccessToken(otherUser.getUserId(), Role.SENIOR); + userToken = jwtUtil.generateAccessToken(otherUser.getUserId(), Role.USER); doNothing().when(slackLogErrorMessage).sendSlackLog(any()); } @@ -294,7 +295,7 @@ void getSeniorProfile() throws Exception { @DisplayName("등록된 프로필이 없다면 [내 프로필 수정] 기본 정보를 조회할 수 없다") void getEmptySeniorProfile() throws Exception { mvc.perform(get("/senior/me/profile") - .header(AUTHORIZATION, BEARER + token)) + .header(AUTHORIZATION, BEARER + seniorToken)) .andExpect(status().isOk()) .andExpect(jsonPath("$.code").value(PROFILE_NOT_FOUND.getCode())) .andExpect(jsonPath("$.message").value(NOT_FOUND_PROFILE.getMessage())); @@ -525,7 +526,7 @@ void getSeniorDetailsOthers() throws Exception { updateAvailable(); mvc.perform(get("/senior/{seniorId}", senior.getSeniorId()) - .header(AUTHORIZATION, BEARER + otherToken)) + .header(AUTHORIZATION, BEARER + userToken)) .andExpect(status().isOk()) .andExpect(jsonPath("$.code").value(SENIOR_FIND.getCode())) .andExpect(jsonPath("$.message").value(GET_SENIOR_INFO.getMessage())) @@ -566,7 +567,7 @@ void testGetSeniorProfile() throws Exception { updateAvailable(); mvc.perform(get("/senior/{seniorId}/profile", senior.getSeniorId()) - .header(AUTHORIZATION, BEARER + otherToken)) + .header(AUTHORIZATION, BEARER + userToken)) .andExpect(status().isOk()) .andExpect(jsonPath("$.code").value(SENIOR_FIND.getCode())) .andExpect(jsonPath("$.message").value(GET_SENIOR_INFO.getMessage()))