From 2ba7596fa2588d51526a133a19c977b92577512f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=95=98=EB=AF=BC?= Date: Mon, 29 Dec 2025 09:31:31 +0900 Subject: [PATCH 1/6] =?UTF-8?q?add=20::=20OPTIONS=20=EA=B1=B4=EB=84=88?= =?UTF-8?q?=EB=9C=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/team/cklob/gami/global/filter/JwtFilter.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/team/cklob/gami/global/filter/JwtFilter.java b/src/main/java/com/team/cklob/gami/global/filter/JwtFilter.java index abf1b670..cf1b2207 100644 --- a/src/main/java/com/team/cklob/gami/global/filter/JwtFilter.java +++ b/src/main/java/com/team/cklob/gami/global/filter/JwtFilter.java @@ -37,6 +37,11 @@ protected void doFilterInternal( FilterChain filterChain ) throws ServletException, IOException { + if ("OPTIONS".equalsIgnoreCase(request.getMethod())) { + filterChain.doFilter(request, response); + return; + } + String jwt = tokenParser.resolveToken(request); if (StringUtils.hasText(jwt) && jwtProvider.validateAccessToken(jwt)) { From 0e504b8208d17c56e3d10cfac1b0474881f8d320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=95=98=EB=AF=BC?= Date: Mon, 29 Dec 2025 09:32:13 +0900 Subject: [PATCH 2/6] =?UTF-8?q?refactor=20::=20=EA=B3=B5=EB=B0=B1=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 487e771e..4af53b35 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -58,7 +58,7 @@ app: env: ${APP_ENV:local} cors: - allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:3000,https://port-0-gami-server-mj0rdvda8d11523e.sel3.cloudtype.app, http://localhost:5173, https://cklob-gami.vercel.app} + allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:3000,https://port-0-gami-server-mj0rdvda8d11523e.sel3.cloudtype.app,http://localhost:5173,https://cklob-gami.vercel.app} cloud: aws: From 7328e3ed1268b1258db3482c8afdfe08a8f8dce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=95=98=EB=AF=BC?= Date: Mon, 29 Dec 2025 18:29:52 +0900 Subject: [PATCH 3/6] =?UTF-8?q?add=20::=20=ED=8C=8C=EB=9D=BC=EB=AF=B8?= =?UTF-8?q?=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cklob/gami/domain/chat/repository/ChatRoomRepository.java | 3 ++- .../domain/chat/service/impl/CreateChatRoomServiceImpl.java | 2 +- .../mentoring/service/impl/MentoringApplyServiceImpl.java | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/team/cklob/gami/domain/chat/repository/ChatRoomRepository.java b/src/main/java/com/team/cklob/gami/domain/chat/repository/ChatRoomRepository.java index c84f745f..7f8e4cb9 100644 --- a/src/main/java/com/team/cklob/gami/domain/chat/repository/ChatRoomRepository.java +++ b/src/main/java/com/team/cklob/gami/domain/chat/repository/ChatRoomRepository.java @@ -1,6 +1,7 @@ package com.team.cklob.gami.domain.chat.repository; import com.team.cklob.gami.domain.chat.entity.ChatRoom; +import com.team.cklob.gami.domain.chat.entity.constant.RoomStatus; import com.team.cklob.gami.domain.member.entity.MemberDetail; import org.springframework.data.repository.query.Param; import org.springframework.data.jpa.repository.JpaRepository; @@ -10,7 +11,7 @@ import java.util.Optional; public interface ChatRoomRepository extends JpaRepository { - boolean existsByMenteeIdAndMentorId(Long menteeId, Long mentorId); + boolean existsByMenteeIdAndMentorIdAndRoomStatus(Long menteeId, Long mentorId, RoomStatus roomStatus); @Query("SELECT CASE WHEN COUNT(cr) > 0 THEN true ELSE false END FROM ChatRoom cr " + "WHERE cr.id = :roomId AND (cr.mentor.id = :memberId OR cr.mentee.id = :memberId)") diff --git a/src/main/java/com/team/cklob/gami/domain/chat/service/impl/CreateChatRoomServiceImpl.java b/src/main/java/com/team/cklob/gami/domain/chat/service/impl/CreateChatRoomServiceImpl.java index dabe5959..dbf7c4b7 100644 --- a/src/main/java/com/team/cklob/gami/domain/chat/service/impl/CreateChatRoomServiceImpl.java +++ b/src/main/java/com/team/cklob/gami/domain/chat/service/impl/CreateChatRoomServiceImpl.java @@ -29,7 +29,7 @@ public class CreateChatRoomServiceImpl implements CreateChatRoomService { @Transactional public void execute(Long applyId, Long menteeId, Long mentorId) { - if (chatRoomRepository.existsByMenteeIdAndMentorId(menteeId, mentorId)) { + if (chatRoomRepository.existsByMenteeIdAndMentorIdAndRoomStatus(menteeId, mentorId, RoomStatus.ACTIVE)) { throw new AlreadyExistChatRoomException(); } Apply apply = applyRepository.findById(applyId) diff --git a/src/main/java/com/team/cklob/gami/domain/mentoring/service/impl/MentoringApplyServiceImpl.java b/src/main/java/com/team/cklob/gami/domain/mentoring/service/impl/MentoringApplyServiceImpl.java index 9654f94e..9ab13e50 100644 --- a/src/main/java/com/team/cklob/gami/domain/mentoring/service/impl/MentoringApplyServiceImpl.java +++ b/src/main/java/com/team/cklob/gami/domain/mentoring/service/impl/MentoringApplyServiceImpl.java @@ -1,5 +1,6 @@ package com.team.cklob.gami.domain.mentoring.service.impl; +import com.team.cklob.gami.domain.chat.entity.constant.RoomStatus; import com.team.cklob.gami.domain.chat.exception.AlreadyExistChatRoomException; import com.team.cklob.gami.domain.chat.repository.ChatRoomRepository; import com.team.cklob.gami.domain.member.entity.Member; @@ -44,7 +45,7 @@ public MentoringApplyResponse execute(Long mentorId) { throw new AlreadyRegisteredMentorException(); } - if (chatRoomRepository.existsByMenteeIdAndMentorId(mentee.getId(), mentorId)) { + if (chatRoomRepository.existsByMenteeIdAndMentorIdAndRoomStatus(mentee.getId(), mentorId, RoomStatus.ACTIVE)) { throw new AlreadyExistChatRoomException(); } From 6be802d92cdcc68819cf381ecbc8a4fbeea32939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=95=98=EB=AF=BC?= Date: Mon, 29 Dec 2025 18:30:55 +0900 Subject: [PATCH 4/6] =?UTF-8?q?refactor=20::=20JPQL=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/MemberDetailRepository.java | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/team/cklob/gami/domain/member/repository/MemberDetailRepository.java b/src/main/java/com/team/cklob/gami/domain/member/repository/MemberDetailRepository.java index b64f7487..d35045a0 100644 --- a/src/main/java/com/team/cklob/gami/domain/member/repository/MemberDetailRepository.java +++ b/src/main/java/com/team/cklob/gami/domain/member/repository/MemberDetailRepository.java @@ -1,5 +1,6 @@ package com.team.cklob.gami.domain.member.repository; +import com.team.cklob.gami.domain.chat.entity.constant.RoomStatus; import com.team.cklob.gami.domain.member.entity.MemberDetail; import com.team.cklob.gami.domain.member.entity.constant.Major; import org.springframework.data.repository.query.Param; @@ -30,17 +31,36 @@ Page findAllWithFilters( Pageable pageable ); - @Query("SELECT md FROM MemberDetail md JOIN md.member m WHERE " + - "(:major IS NULL OR md.major = :major) AND " + - "(:name IS NULL OR m.name LIKE %:name%) AND " + - "(:generation IS NULL OR md.generation < :generation)") - Page findAllWithFiltersIncludingSeniors( + @Query(""" + SELECT md + FROM MemberDetail md + JOIN md.member m + WHERE + (:major IS NULL OR md.major = :major) + AND (:name IS NULL OR m.name LIKE %:name%) + AND (:generation IS NULL OR md.generation < :generation) + AND m.id <> :memberId + AND NOT EXISTS ( + SELECT 1 + FROM ChatRoom r + WHERE r.roomStatus = :roomStatus + AND ( + (r.mentor.id = :memberId AND r.mentee.id = m.id) + OR + (r.mentor.id = m.id AND r.mentee.id = :memberId) + ) + ) + """) + Page findAllWithFiltersIncludingSeniorsExcludeActiveRoom( @Param("major") Major major, @Param("name") String name, @Param("generation") Integer generation, + @Param("memberId") Long memberId, + @Param("roomStatus") RoomStatus roomStatus, Pageable pageable ); + @Query(value = "SELECT * FROM member_detail md " + "WHERE md.major = :#{#major.name()} " + "AND md.generation < :generation " + From 766ee73e70f227579ede25324a6d5a72d01d0429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=95=98=EB=AF=BC?= Date: Mon, 29 Dec 2025 18:31:13 +0900 Subject: [PATCH 5/6] =?UTF-8?q?add=20::=20memberUtil=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mentoring/service/impl/GetMentorListServiceImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/team/cklob/gami/domain/mentoring/service/impl/GetMentorListServiceImpl.java b/src/main/java/com/team/cklob/gami/domain/mentoring/service/impl/GetMentorListServiceImpl.java index db67375d..59543680 100644 --- a/src/main/java/com/team/cklob/gami/domain/mentoring/service/impl/GetMentorListServiceImpl.java +++ b/src/main/java/com/team/cklob/gami/domain/mentoring/service/impl/GetMentorListServiceImpl.java @@ -1,11 +1,13 @@ package com.team.cklob.gami.domain.mentoring.service.impl; +import com.team.cklob.gami.domain.chat.entity.constant.RoomStatus; import com.team.cklob.gami.domain.member.entity.Member; import com.team.cklob.gami.domain.member.entity.MemberDetail; import com.team.cklob.gami.domain.member.entity.constant.Major; import com.team.cklob.gami.domain.member.repository.MemberDetailRepository; import com.team.cklob.gami.domain.mentoring.dto.response.GetMentorResponse; import com.team.cklob.gami.domain.mentoring.service.GetMentorListService; +import com.team.cklob.gami.global.util.MemberUtil; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -17,6 +19,7 @@ public class GetMentorListServiceImpl implements GetMentorListService { private final MemberDetailRepository memberDetailRepository; + private final MemberUtil memberUtil; @Override @Transactional(readOnly = true) @@ -25,9 +28,10 @@ public Page execute( String name, Integer generation, Pageable pageable) { + Member member = memberUtil.getCurrentMember(); - Page detailsPage = memberDetailRepository.findAllWithFiltersIncludingSeniors( - major, name, generation, pageable + Page detailsPage = memberDetailRepository.findAllWithFiltersIncludingSeniorsExcludeActiveRoom( + major, name, generation, member.getId(), RoomStatus.ACTIVE, pageable ); return detailsPage.map(detail -> { From 5310e978b4242ca3815761a62d82b423a01a55cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=95=98=EB=AF=BC?= Date: Mon, 29 Dec 2025 22:19:50 +0900 Subject: [PATCH 6/6] =?UTF-8?q?refactor=20::=20=EB=A9=94=EC=86=8C=EB=93=9C?= =?UTF-8?q?=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cklob/gami/domain/mentoring/repository/ApplyRepository.java | 2 +- .../mentoring/service/impl/MentoringApplyServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/team/cklob/gami/domain/mentoring/repository/ApplyRepository.java b/src/main/java/com/team/cklob/gami/domain/mentoring/repository/ApplyRepository.java index 2f6e1429..06cc1d8e 100644 --- a/src/main/java/com/team/cklob/gami/domain/mentoring/repository/ApplyRepository.java +++ b/src/main/java/com/team/cklob/gami/domain/mentoring/repository/ApplyRepository.java @@ -10,7 +10,7 @@ public interface ApplyRepository extends JpaRepository { - Boolean existsByMenteeIdAndMentorIdAndApplyStatusIn(Long menteeId, Long mentorId, List applyStatus); + Boolean existsByMenteeIdAndMentorIdAndApplyStatus(Long menteeId, Long mentorId, ApplyStatus applyStatus); @Query("SELECT a FROM Apply a JOIN FETCH a.mentor WHERE a.mentee.id = :menteeId AND a.applyStatus = :applyStatus ORDER BY a.createdAt DESC") List findAllByMenteeIdAndApplyStatusWithMentor(@Param("menteeId") Long menteeId, @Param("applyStatus") ApplyStatus applyStatus); diff --git a/src/main/java/com/team/cklob/gami/domain/mentoring/service/impl/MentoringApplyServiceImpl.java b/src/main/java/com/team/cklob/gami/domain/mentoring/service/impl/MentoringApplyServiceImpl.java index 9ab13e50..0e762217 100644 --- a/src/main/java/com/team/cklob/gami/domain/mentoring/service/impl/MentoringApplyServiceImpl.java +++ b/src/main/java/com/team/cklob/gami/domain/mentoring/service/impl/MentoringApplyServiceImpl.java @@ -41,7 +41,7 @@ public MentoringApplyResponse execute(Long mentorId) { throw new SelfApplyNotAllowedException(); } - if (applyRepository.existsByMenteeIdAndMentorIdAndApplyStatusIn(mentee.getId(), mentor.getId(), List.of(ApplyStatus.PENDING, ApplyStatus.ACCEPTED))) { + if (applyRepository.existsByMenteeIdAndMentorIdAndApplyStatus(mentee.getId(), mentor.getId(), ApplyStatus.PENDING)) { throw new AlreadyRegisteredMentorException(); }