Skip to content

Commit

Permalink
[feat] #19 member info, waiting repository
Browse files Browse the repository at this point in the history
  • Loading branch information
nykoh2001 committed Feb 13, 2024
1 parent 96a9cb6 commit 2804d8e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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<MemberInfo, Long> {
default MemberInfo findByMemberIdOrThrow(Long memberId) {
return findByMemberId(memberId).orElseThrow(() -> new CustomException(ErrorMessage.MEMBER_INFO_NOT_FOUND));
}

Optional<MemberInfo> findByMemberId(Long memberId);
}
12 changes: 12 additions & 0 deletions src/main/java/org/harang/server/repository/WaitingRepository.java
Original file line number Diff line number Diff line change
@@ -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<Waiting, Long> {
List<Waiting> findAllByPostId(Long postId);
}

0 comments on commit 2804d8e

Please sign in to comment.