forked from codesquad-members-2022/airbnb
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Team-12][BE][동기&루이] - API 설계 마무리 (codesquad-members-2022#93)
* [#4] Refactor: 패키지 구조 변경 - controller, service, repository로 구성되어있던 패키지 구조를 도메인별 패키지 구조로 변경 * [#4] Refactor: API 설계에 따라 도메인 객체 수정 - 기존의 AccommodationController를 RegionController로 변경 - PopularDestination을 TravelController로 변경 - dto를 도메인에 맞게 수정하여 해당 도메인 패키지 하위 dto 패키지로 이동 * [#4] Refactor: 지역을 파라미터로 입력 받기 위해 메서드에 파라미터 추가 - 리팩토링하는 과정에서 누락된 파라미터 추가
- Loading branch information
1 parent
f3522a6
commit 16c90ae
Showing
12 changed files
with
95 additions
and
96 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...ong/airbnb/controller/MainController.java → .../dong/airbnb/banner/BannerController.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
20 changes: 0 additions & 20 deletions
20
BE/src/main/java/louie/dong/airbnb/controller/AccommodationController.java
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
BE/src/main/java/louie/dong/airbnb/controller/PopularDestinationController.java
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
BE/src/main/java/louie/dong/airbnb/dto/SearchCountryResponse.java
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
BE/src/main/java/louie/dong/airbnb/region/MockRegionService.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,18 @@ | ||
package louie.dong.airbnb.region; | ||
|
||
import java.util.List; | ||
import louie.dong.airbnb.region.dto.SearchRegionResponse; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class MockRegionService { | ||
|
||
public List<SearchRegionResponse> findByRegion(String country) { | ||
return List.of( | ||
new SearchRegionResponse("양재동, 서초구, 서울특별시", ""), | ||
new SearchRegionResponse("양재역 사거리, 양재1동", ""), | ||
new SearchRegionResponse("서울특별시 양재2동 시민의숲앞", ""), | ||
new SearchRegionResponse("서울특별시 양재2동 양재IC", "") | ||
); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
BE/src/main/java/louie/dong/airbnb/region/RegionController.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,20 @@ | ||
package louie.dong.airbnb.region; | ||
|
||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import louie.dong.airbnb.region.dto.SearchRegionResponse; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
public class RegionController { | ||
|
||
private final MockRegionService mockRegionService; | ||
|
||
@GetMapping("/regions/search") | ||
public List<SearchRegionResponse> getSearchRegions(String country) { | ||
return mockRegionService.findByRegion(country); | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
BE/src/main/java/louie/dong/airbnb/region/dto/SearchRegionResponse.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 louie.dong.airbnb.region.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class SearchRegionResponse { | ||
|
||
private String country; | ||
private String imageUrl; | ||
} |
18 changes: 0 additions & 18 deletions
18
BE/src/main/java/louie/dong/airbnb/service/MockAccommodationService.java
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
BE/src/main/java/louie/dong/airbnb/service/MockPopularDestinationService.java
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
BE/src/main/java/louie/dong/airbnb/travel/MockTravelService.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,22 @@ | ||
package louie.dong.airbnb.travel; | ||
|
||
import java.util.List; | ||
import louie.dong.airbnb.travel.dto.PopularTravelResponse; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class MockTravelService { | ||
|
||
public List<PopularTravelResponse> findAll() { | ||
return List.of( | ||
new PopularTravelResponse("서울", "", "차로 30분 거리"), | ||
new PopularTravelResponse("광주", "", "차로 4시간 거리"), | ||
new PopularTravelResponse("의정부시", "", "차로 30분 거리"), | ||
new PopularTravelResponse("수원시", "", "차로 45분 거리"), | ||
new PopularTravelResponse("대구", "", "차로 3.5시간 거리"), | ||
new PopularTravelResponse("울산", "", "차로 4.5시간 거리"), | ||
new PopularTravelResponse("대전", "", "차로 2시간 거리"), | ||
new PopularTravelResponse("부천시", "", "차로 30분 거리") | ||
); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
BE/src/main/java/louie/dong/airbnb/travel/TravelController.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,19 @@ | ||
package louie.dong.airbnb.travel; | ||
|
||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import louie.dong.airbnb.travel.dto.PopularTravelResponse; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
public class TravelController { | ||
|
||
private final MockTravelService mockTravelService; | ||
|
||
@GetMapping("/travel/popular") | ||
public List<PopularTravelResponse> getPopularDestinations() { | ||
return mockTravelService.findAll(); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...irbnb/dto/PopularDestinationResponse.java → ...bnb/travel/dto/PopularTravelResponse.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