Skip to content

Commit

Permalink
가장 많이 선택한 메뉴 10위까지 응답, 메뉴를 판매하는 식당 목록 응답 EndPoint 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jy-b authored Oct 2, 2023
1 parent 6fa8214 commit 0bb8cd9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
Expand All @@ -40,8 +40,8 @@ public ResponseEntity<Success<List<RouletteMenuDTO>>> getRouletteMenus(@LoginAct
return ApiResponse.success(rouletteMenuDTOs, HttpStatus.OK);
}

@GetMapping("/api/menus/buildings/{buildingId}")
public ResponseEntity<Success<List<MostSelectedMenuDTO>>> getMostSelectedMenu(@PathVariable("buildingId") Long buildingId, @LoginActor Actor actor) {
@GetMapping("/api/menus/choices")
public ResponseEntity<Success<List<MostSelectedMenuDTO>>> getMostSelectedMenu(@RequestParam("buildingId") Long buildingId, @LoginActor Actor actor) {

JwtTokenProvider.checkMemberToken(actor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.livable.server.restaurant.dto.RestaurantResponse;
import com.livable.server.restaurant.dto.RestaurantResponse.RestaurantsByMenuDto;
import com.livable.server.restaurant.service.RestaurantService;
import lombok.Getter;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -18,9 +18,6 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequiredArgsConstructor
@RestController
Expand Down Expand Up @@ -60,9 +57,9 @@ public ResponseEntity<ApiResponse.Success<List<RestaurantResponse.listMenuDTO>>>
return ApiResponse.success(result, HttpStatus.OK);
}

@GetMapping("/restaurants/menus/{menuId}")
@GetMapping("/restaurants")
public ResponseEntity<Success<List<RestaurantsByMenuDto>>> getRestaurantsByMenu(
@PathVariable("menuId") Long menuId, @LoginActor Actor actor
@RequestParam("menuId") Long menuId, @LoginActor Actor actor
) {

JwtTokenProvider.checkMemberToken(actor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void getMostSelectedMenusSuccess() throws Exception {

//when & then
mockMvc.perform(
get("/api/menus/buildings/{buildingId}", 1)
get("/api/menus/choices?buildingId=1")
.header("Authorization", "Bearer " + token)
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void findRestaurantByMenuSuccess() throws Exception {
.willReturn(result);

// when & then
mockMvc.perform(get("/api/restaurants/menus/{menuId}", 1)
mockMvc.perform(get("/api/restaurants?menuId=1")
.header("Authorization", "Bearer " + token)
)
.andExpect(status().isOk())
Expand All @@ -112,7 +112,7 @@ void findRestaurantByMenuFailed() throws Exception {
new GlobalRuntimeException(RestaurantErrorCode.NOT_FOUND_RESTAURANT_BY_MENU));

// when & then
mockMvc.perform(get("/api/restaurants/menus/{menuId}", 1)
mockMvc.perform(get("/api/restaurants?menuId=1")
.header("Authorization", "Bearer " + token)
)
.andExpect(status().isBadRequest())
Expand Down

0 comments on commit 0bb8cd9

Please sign in to comment.