-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BE]REFACTOR : optional fetcher 구조로 변경
- Loading branch information
Showing
3 changed files
with
99 additions
and
56 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
backend/src/main/java/org/ftclub/cabinet/user/repository/LentExtensionOptionalFetcher.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,25 @@ | ||
package org.ftclub.cabinet.user.repository; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.log4j.Log4j2; | ||
import org.ftclub.cabinet.exception.ExceptionStatus; | ||
import org.ftclub.cabinet.exception.ServiceException; | ||
import org.ftclub.cabinet.user.domain.LentExtension; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Log4j2 | ||
public class LentExtensionOptionalFetcher { | ||
|
||
private final LentExtensionRepository lentExtensionRepository; | ||
|
||
/*-------------------------------------------FIND-------------------------------------------*/ | ||
/*-------------------------------------------GET--------------------------------------------*/ | ||
public LentExtension getAvailableLentExtensionByUserId(Long userId) { | ||
log.debug("Called findLentExtensionByUserId: {}", userId); | ||
return lentExtensionRepository.findLentExtensionByUserIdAndUsedAtIsNull(userId).orElseThrow( | ||
() -> new ServiceException(ExceptionStatus.EXTENSION_TICKET_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