-
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.
Browse files
Browse the repository at this point in the history
* refactor: in 사용하여 지역 중복 선택 가능하도록 변경 * del: 필요없는 예외처리 삭제
- Loading branch information
Showing
7 changed files
with
44 additions
and
33 deletions.
There are no files selected for viewing
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
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
11 changes: 6 additions & 5 deletions
11
src/main/java/org/sophy/sophy/infrastructure/PlaceRepository.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 |
---|---|---|
@@ -1,22 +1,23 @@ | ||
package org.sophy.sophy.infrastructure; | ||
|
||
import org.sophy.sophy.domain.enumerate.City; | ||
import java.util.List; | ||
import org.sophy.sophy.domain.Place; | ||
import org.sophy.sophy.domain.enumerate.City; | ||
import org.sophy.sophy.exception.ErrorStatus; | ||
import org.sophy.sophy.exception.model.NotFoundException; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface PlaceRepository extends JpaRepository<Place, Long> { | ||
List<Place> findAllByCity(City city); | ||
|
||
List<Place> findByCityIn(List<City> cities); | ||
|
||
List<Place> findAll(); | ||
|
||
default Place getPlaceById(Long placeId) { | ||
return this.findById(placeId) | ||
.orElseThrow(() -> new NotFoundException(ErrorStatus.NOT_FOUND_PLACE_EXCEPTION, ErrorStatus.NOT_FOUND_PLACE_EXCEPTION.getMessage())); | ||
.orElseThrow(() -> new NotFoundException(ErrorStatus.NOT_FOUND_PLACE_EXCEPTION, | ||
ErrorStatus.NOT_FOUND_PLACE_EXCEPTION.getMessage())); | ||
} | ||
} |
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
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