Skip to content

Commit

Permalink
🚑 Fix: FoodController 음식 수정/삭제 메서드 연월일 매개변수 추가 (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
win-luck committed Nov 12, 2023
1 parent 532344d commit d95a931
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.diareat.diareat.util.api.ResponseCode;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

Expand Down Expand Up @@ -45,15 +44,23 @@ public ApiResponse<List<ResponseFoodDto>> getFoodListByDate(@PathVariable Long u
//음식 정보 수정
@Operation(summary = "[음식] 음식 정보 수정",description = "음식에 대한 정보를 수정합니다.")
@PostMapping("/update")
public ApiResponse<Void> updateFood(@RequestBody @Valid UpdateFoodDto updateFoodDto){
foodService.updateFood(updateFoodDto);
public ApiResponse<Void> updateFood(@RequestBody @Valid UpdateFoodDto updateFoodDto,
@RequestParam int yy,
@RequestParam int mm,
@RequestParam int dd){
LocalDate date = LocalDate.of(yy,mm,dd);
foodService.updateFood(updateFoodDto, date);
return ApiResponse.success(null,ResponseCode.FOOD_UPDATE_SUCCESS.getMessage());
}
//음식 삭제
@Operation(summary = "[음식] 음식 정보 삭제",description = "음식에 대한 정보를 삭제합니다.")
@DeleteMapping("/{foodId}/delete")
public ApiResponse<Void> deleteFood(@PathVariable Long foodId, @RequestHeader Long userId){
foodService.deleteFood(foodId, userId);
public ApiResponse<Void> deleteFood(@PathVariable Long foodId, @RequestHeader Long userId,
@RequestParam int yy,
@RequestParam int mm,
@RequestParam int dd){
LocalDate date = LocalDate.of(yy,mm,dd);
foodService.deleteFood(foodId, userId, date);
return ApiResponse.success(null, ResponseCode.FOOD_DELETE_SUCCESS.getMessage());
}

Expand Down

0 comments on commit d95a931

Please sign in to comment.