diff --git a/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/GetCategoryController.kt b/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/GetCategoryController.kt new file mode 100644 index 0000000..2ada0b5 --- /dev/null +++ b/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/GetCategoryController.kt @@ -0,0 +1,31 @@ +package com.restaurant.be.restaurant.presentation.controller + +import com.restaurant.be.common.response.CommonResponse +import com.restaurant.be.restaurant.presentation.dto.GetCategoryResponse +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.media.Content +import io.swagger.v3.oas.annotations.media.Schema +import io.swagger.v3.oas.annotations.responses.ApiResponse +import org.springframework.security.access.prepost.PreAuthorize +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController + +@Api(tags = ["02. Restaurant Info"], description = "음식점 서비스") +@RestController +@RequestMapping("/api/v1/restaurants/category") +class GetCategoryController { + + @GetMapping + @PreAuthorize("hasRole('USER')") + @ApiOperation(value = "카테고리 전체 조회 API") + @ApiResponse( + responseCode = "200", + description = "성공", + content = [Content(schema = Schema(implementation = GetCategoryResponse::class))] + ) + fun getCategory(): CommonResponse { + return CommonResponse.success() + } +} diff --git a/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/GetKingoPassController.kt b/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/GetKingoPassController.kt new file mode 100644 index 0000000..6628dad --- /dev/null +++ b/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/GetKingoPassController.kt @@ -0,0 +1,32 @@ +package com.restaurant.be.restaurant.presentation.controller + +import com.restaurant.be.common.response.CommonResponse +import com.restaurant.be.restaurant.presentation.dto.GetKingoPassResponse +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.media.Content +import io.swagger.v3.oas.annotations.media.Schema +import io.swagger.v3.oas.annotations.responses.ApiResponse +import org.springframework.security.access.prepost.PreAuthorize +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import java.security.Principal + +@Api(tags = ["02. Restaurant Info"], description = "음식점 서비스") +@RestController +@RequestMapping("/v1/restaurants/kingo-pass") +class GetKingoPassController { + + @GetMapping + @PreAuthorize("hasRole('USER')") + @ApiOperation(value = "성대 킹고 패스 음식점 리스트 조회 API") + @ApiResponse( + responseCode = "200", + description = "성공", + content = [Content(schema = Schema(implementation = GetKingoPassResponse::class))] + ) + fun getRecentHighReview(principal: Principal): CommonResponse { + return CommonResponse.success() + } +} diff --git a/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/GetRestaurantController.kt b/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/GetRestaurantController.kt new file mode 100644 index 0000000..0192b1d --- /dev/null +++ b/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/GetRestaurantController.kt @@ -0,0 +1,56 @@ +package com.restaurant.be.restaurant.presentation.controller + +import com.restaurant.be.common.response.CommonResponse +import com.restaurant.be.restaurant.presentation.dto.GetRestaurantRequest +import com.restaurant.be.restaurant.presentation.dto.GetRestaurantResponse +import com.restaurant.be.restaurant.presentation.dto.GetRestaurantsResponse +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.media.Content +import io.swagger.v3.oas.annotations.media.Schema +import io.swagger.v3.oas.annotations.responses.ApiResponse +import org.springframework.data.domain.Pageable +import org.springframework.security.access.prepost.PreAuthorize +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.ModelAttribute +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import java.security.Principal + +@Api(tags = ["02. Restaurant Info"], description = "음식점 서비스") +@RestController +@RequestMapping("/api/v1/restaurants") +class GetRestaurantController { + + @GetMapping + @PreAuthorize("hasRole('USER')") + @ApiOperation(value = "음식점 조회 API") + @ApiResponse( + responseCode = "200", + description = "성공", + content = [Content(schema = Schema(implementation = GetRestaurantsResponse::class))] + ) + fun getRestaurants( + principal: Principal, + @ModelAttribute request: GetRestaurantRequest, + pageable: Pageable + ): CommonResponse { + return CommonResponse.success() + } + + @GetMapping("/{restaurantId}") + @PreAuthorize("hasRole('USER')") + @ApiOperation(value = "음식점 상세 조회 API") + @ApiResponse( + responseCode = "200", + description = "성공", + content = [Content(schema = Schema(implementation = GetRestaurantResponse::class))] + ) + fun getRestaurant( + principal: Principal, + @PathVariable restaurantId: String + ): CommonResponse { + return CommonResponse.success() + } +} diff --git a/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/LikeRestaurantController.kt b/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/LikeRestaurantController.kt new file mode 100644 index 0000000..0decccd --- /dev/null +++ b/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/LikeRestaurantController.kt @@ -0,0 +1,59 @@ +package com.restaurant.be.restaurant.presentation.controller + +import com.restaurant.be.common.response.CommonResponse +import com.restaurant.be.restaurant.presentation.dto.GetLikeRestaurantsResponse +import com.restaurant.be.restaurant.presentation.dto.LikeRestaurantRequest +import com.restaurant.be.restaurant.presentation.dto.LikeRestaurantResponse +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.media.Content +import io.swagger.v3.oas.annotations.media.Schema +import io.swagger.v3.oas.annotations.responses.ApiResponse +import org.springframework.data.domain.Pageable +import org.springframework.security.access.prepost.PreAuthorize +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import java.security.Principal +import javax.validation.Valid + +@Api(tags = ["02. Restaurant Info"], description = "음식점 서비스") +@RestController +@RequestMapping("/api/v1/restaurants") +class LikeRestaurantController { + + @GetMapping("/like") + @PreAuthorize("hasRole('USER')") + @ApiOperation(value = "좋아요한 음식점 리스트 조회 API") + @ApiResponse( + responseCode = "200", + description = "성공", + content = [Content(schema = Schema(implementation = GetLikeRestaurantsResponse::class))] + ) + fun getLikeRestaurants( + principal: Principal, + pageable: Pageable + ): CommonResponse { + return CommonResponse.success() + } + + @PostMapping("/{restaurantId}/like") + @PreAuthorize("hasRole('USER')") + @ApiOperation(value = "음식점 좋아요 API") + @ApiResponse( + responseCode = "200", + description = "성공", + content = [Content(schema = Schema(implementation = LikeRestaurantResponse::class))] + ) + fun likeRestaurant( + principal: Principal, + @PathVariable restaurantId: String, + @RequestBody @Valid + request: LikeRestaurantRequest + ): CommonResponse { + return CommonResponse.success() + } +} diff --git a/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/RecommendRestaurantController.kt b/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/RecommendRestaurantController.kt new file mode 100644 index 0000000..28d60e5 --- /dev/null +++ b/src/main/kotlin/com/restaurant/be/restaurant/presentation/controller/RecommendRestaurantController.kt @@ -0,0 +1,34 @@ +package com.restaurant.be.restaurant.presentation.controller + +import com.restaurant.be.common.response.CommonResponse +import com.restaurant.be.restaurant.presentation.dto.RecommendRestaurantResponse +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.media.Content +import io.swagger.v3.oas.annotations.media.Schema +import io.swagger.v3.oas.annotations.responses.ApiResponse +import org.springframework.security.access.prepost.PreAuthorize +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import java.security.Principal + +@Api(tags = ["02. Restaurant Info"], description = "음식점 서비스") +@RestController +@RequestMapping("/api/v1/restaurants") +class RecommendRestaurantController { + + @GetMapping("recommend") + @PreAuthorize("hasRole('USER')") + @ApiOperation(value = "gpt 기반 추천 음식점 리스트 조회 API") + @ApiResponse( + responseCode = "200", + description = "성공", + content = [Content(schema = Schema(implementation = RecommendRestaurantResponse::class))] + ) + fun getRecommendRestaurants( + principal: Principal + ): CommonResponse { + return CommonResponse.success() + } +} diff --git a/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/GetCategoryDto.kt b/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/GetCategoryDto.kt new file mode 100644 index 0000000..26bcc01 --- /dev/null +++ b/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/GetCategoryDto.kt @@ -0,0 +1,11 @@ +@file:Suppress("ktlint", "MatchingDeclarationName") + +package com.restaurant.be.restaurant.presentation.dto + +import com.restaurant.be.restaurant.presentation.dto.common.CategoryDto +import io.swagger.v3.oas.annotations.media.Schema + +data class GetCategoryResponse( + @Schema(description = "카테고리 리스트") + val categories: List +) diff --git a/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/GetKingoPassDto.kt b/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/GetKingoPassDto.kt new file mode 100644 index 0000000..6de7c5d --- /dev/null +++ b/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/GetKingoPassDto.kt @@ -0,0 +1,11 @@ +@file:Suppress("ktlint", "MatchingDeclarationName") + +package com.restaurant.be.restaurant.presentation.dto + +import com.restaurant.be.restaurant.presentation.dto.common.RestaurantDto +import io.swagger.v3.oas.annotations.media.Schema + +data class GetKingoPassResponse( + @Schema(description = "킹고패스 식당 리스트") + val restaurants: List +) diff --git a/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/GetRestaurantDto.kt b/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/GetRestaurantDto.kt new file mode 100644 index 0000000..746e7a0 --- /dev/null +++ b/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/GetRestaurantDto.kt @@ -0,0 +1,28 @@ +package com.restaurant.be.restaurant.presentation.dto + +import com.restaurant.be.restaurant.presentation.dto.common.RestaurantDto +import io.swagger.annotations.ApiModelProperty +import io.swagger.v3.oas.annotations.media.Schema + +data class GetRestaurantRequest( + @ApiModelProperty(value = "식당 이름 검색", example = "맛집", required = false) + val query: String, + @ApiModelProperty(value = "카테고리 필터", example = "[1, 2, 3]", required = false) + val categoryIds: List, + @ApiModelProperty(value = "킹고패스 할인 여부 필터", example = "false", required = false) + val discountForSkku: Boolean, + @ApiModelProperty(value = "평점 필터", example = "4.5", required = false) + val rating: Long, + @ApiModelProperty(value = "리뷰 개수 필터", example = "100", required = false) + val reviewCount: Long +) + +data class GetRestaurantsResponse( + @Schema(description = "식당 리스트") + val restaurants: List +) + +data class GetRestaurantResponse( + @Schema(description = "식당 정보") + val restaurant: RestaurantDto +) diff --git a/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/LikeRestaurantDto.kt b/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/LikeRestaurantDto.kt new file mode 100644 index 0000000..5de1601 --- /dev/null +++ b/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/LikeRestaurantDto.kt @@ -0,0 +1,24 @@ +package com.restaurant.be.restaurant.presentation.dto + +import com.restaurant.be.restaurant.presentation.dto.common.RestaurantDto +import io.swagger.annotations.ApiModelProperty +import io.swagger.v3.oas.annotations.media.Schema + +data class GetLikeRestaurantsResponse( + @Schema(description = "좋아요한 식당 리스트") + val restaurants: List +) + +data class LikeRestaurantRequest( + @ApiModelProperty(value = "현재 좋아요 했는지 여부", example = "LIKE", required = true) + val status: LikeRestaurantStatus +) +data class LikeRestaurantResponse( + @Schema(description = "좋아요한 식당 정보") + val restaurant: RestaurantDto +) + +enum class LikeRestaurantStatus { + LIKE, + UNLIKE +} diff --git a/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/RecommendRestaurantDto.kt b/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/RecommendRestaurantDto.kt new file mode 100644 index 0000000..49f3c18 --- /dev/null +++ b/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/RecommendRestaurantDto.kt @@ -0,0 +1,11 @@ +@file:Suppress("ktlint", "MatchingDeclarationName") + +package com.restaurant.be.restaurant.presentation.dto + +import com.restaurant.be.restaurant.presentation.dto.common.RestaurantDto +import io.swagger.v3.oas.annotations.media.Schema + +data class RecommendRestaurantResponse( + @Schema(description = "gpt기반 추천 식당 리스트") + val restaurants: List +) diff --git a/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/common/CategoryDto.kt b/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/common/CategoryDto.kt new file mode 100644 index 0000000..3df392e --- /dev/null +++ b/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/common/CategoryDto.kt @@ -0,0 +1,10 @@ +package com.restaurant.be.restaurant.presentation.dto.common + +import io.swagger.v3.oas.annotations.media.Schema + +data class CategoryDto( + @Schema(description = "카테고리 id") + val id: Long, + @Schema(description = "카테고리 이름") + val name: String +) diff --git a/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/common/RestaurantDto.kt b/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/common/RestaurantDto.kt new file mode 100644 index 0000000..6b830cd --- /dev/null +++ b/src/main/kotlin/com/restaurant/be/restaurant/presentation/dto/common/RestaurantDto.kt @@ -0,0 +1,44 @@ +package com.restaurant.be.restaurant.presentation.dto.common + +import io.swagger.v3.oas.annotations.media.Schema + +data class RestaurantDto( + @Schema(description = "식당 id") + val id: Long, + @Schema(description = "식당 대표 이미지 URL") + val representativeImageUrl: String, + @Schema(description = "식당 이름") + val name: String, + @Schema(description = "식당 평점 평균") + val ratingAvg: Double, + @Schema(description = "식당 리뷰 수") + val reviewCount: Long, + @Schema(description = "식당 좋아요 수") + val likeCount: Long, + @Schema(description = "식당 카테고리") + val category: String, + @Schema(description = "식당 대표 메뉴") + val representativeMenu: String, + @Schema(description = "식당 영업 시작 시간") + val operatingStartTime: String, + @Schema(description = "식당 영업 종료 시간") + val operatingEndTime: String, + @Schema(description = "식당 대표 리뷰 내용") + val representativeReviewContent: String, + @Schema(description = "식당 좋아요 여부(로그인한 유저)") + val isLike: Boolean, + @Schema(description = "식당 할인 여부") + val isDiscountForSkku: Boolean, + @Schema(description = "식당 할인 내용") + val discountContent: String, + + @Schema(description = "식당 상세 정보") + val detailInfo: RestaurantDetailDto +) + +data class RestaurantDetailDto( + @Schema(description = "식당 전화번호") + val contactNumber: String, + @Schema(description = "식당 주소") + val address: String +)