forked from codesquad-members-2024/be-airdnb
-
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
38 additions
and
8 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
30 changes: 30 additions & 0 deletions
30
BE/src/main/java/team07/airbnb/domain/product/ProductController.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,4 +1,34 @@ | ||
package team07.airbnb.domain.product; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import team07.airbnb.domain.accommodation.AccomodationService; | ||
import team07.airbnb.domain.product.dto.ProductListResponse; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
@RequestMapping("/products") | ||
@RestController | ||
@RequiredArgsConstructor | ||
public class ProductController { | ||
|
||
private final AccomodationService accomodationService; | ||
private final ProductService productService; | ||
|
||
@GetMapping("/available") | ||
public List<ProductListResponse> findNearByAvailableProducts( | ||
@RequestParam LocalDate checkIn, | ||
@RequestParam LocalDate checkOut, | ||
@RequestParam double longitude, | ||
@RequestParam double latitude, | ||
@RequestParam double distance) { | ||
|
||
return productService.findAvailableInDateRange( | ||
accomodationService.findNearbyAccommodations(longitude, latitude, distance), | ||
checkIn, checkOut); | ||
} | ||
} |