-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] #19 member info, waiting repository
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/main/java/org/harang/server/repository/MemberInfoRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
12
src/main/java/org/harang/server/repository/WaitingRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |