-
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.
* refactor: ParkingApiService에서 읽어오는 부분 Checked Exception 추가 * refactor: ParkingService에서 트랜잭션 담당하도록 변경
- Loading branch information
Showing
8 changed files
with
91 additions
and
52 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/main/java/com/example/parking/application/parking/ParkingService.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,26 @@ | ||
package com.example.parking.application.parking; | ||
|
||
import com.example.parking.domain.parking.Parking; | ||
import com.example.parking.domain.parking.ParkingRepository; | ||
import java.util.List; | ||
import java.util.Set; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@RequiredArgsConstructor | ||
@Service | ||
public class ParkingService { | ||
|
||
private final ParkingRepository parkingRepository; | ||
|
||
@Transactional | ||
public void saveAll(List<Parking> parkingLots) { | ||
parkingRepository.saveAll(parkingLots); | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
public Set<Parking> getParkingLots(Set<String> parkingNames) { | ||
return parkingRepository.findAllByBaseInformationNameIn(parkingNames); | ||
} | ||
} |
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
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
17 changes: 17 additions & 0 deletions
17
src/test/java/com/example/parking/fake/FakeParkingService.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 com.example.parking.fake; | ||
|
||
import com.example.parking.application.parking.ParkingService; | ||
|
||
public class FakeParkingService extends ParkingService { | ||
|
||
private final BasicParkingRepository repository; | ||
|
||
public FakeParkingService(BasicParkingRepository repository) { | ||
super(repository); | ||
this.repository = repository; | ||
} | ||
|
||
public int count() { | ||
return repository.count(); | ||
} | ||
} |