-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
32 additions
and
13 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
pophory-api/src/main/java/com/pophory/pophoryapi/member/application/MemberFinder.kt
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,23 @@ | ||
package com.pophory.pophoryapi.member.application | ||
|
||
import com.pophory.pophorydomain.member.Member | ||
import com.pophory.pophorydomain.member.infrastructure.MemberJpaRepository | ||
import jakarta.persistence.EntityNotFoundException | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class MemberFinder( | ||
private val memberJpaRepository: MemberJpaRepository | ||
) { | ||
|
||
fun findById(id: Long) : Member { | ||
return memberJpaRepository.findById(id) | ||
.orElseThrow { EntityNotFoundException("Member not found") } | ||
} | ||
|
||
fun findByIdForUpdate(id: Long) : Member { | ||
return memberJpaRepository.findByIdForUpdate(id) | ||
.orElseThrow { EntityNotFoundException("Member not found") } | ||
} | ||
|
||
} |
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
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