diff --git a/src/main/java/org/harang/server/repository/MemberInfoRepository.java b/src/main/java/org/harang/server/repository/MemberInfoRepository.java new file mode 100644 index 0000000..d916c47 --- /dev/null +++ b/src/main/java/org/harang/server/repository/MemberInfoRepository.java @@ -0,0 +1,17 @@ +성package org.harang.server.repository; + +import java.util.Optional; +import org.harang.server.domain.MemberInfo; +import org.harang.server.dto.type.ErrorMessage; +import org.harang.server.exception.CustomException; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface MemberInfoRepository extends JpaRepository { + default MemberInfo findByMemberIdOrThrow(Long memberId) { + return findByMemberId(memberId).orElseThrow(() -> new CustomException(ErrorMessage.MEMBER_INFO_NOT_FOUND)); + } + + Optional findByMemberId(Long memberId); +} diff --git a/src/main/java/org/harang/server/repository/WaitingRepository.java b/src/main/java/org/harang/server/repository/WaitingRepository.java new file mode 100644 index 0000000..36f55b2 --- /dev/null +++ b/src/main/java/org/harang/server/repository/WaitingRepository.java @@ -0,0 +1,12 @@ +package org.harang.server.repository; + +import java.util.List; +import org.harang.server.domain.Member; +import org.harang.server.domain.Waiting; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface WaitingRepository extends JpaRepository { + List findAllByPostId(Long postId); +}