From 7372ee44ed5d71dc41cd0bc7e341ad69e308c94d Mon Sep 17 00:00:00 2001 From: CHAE Date: Mon, 4 Dec 2023 21:05:33 +0900 Subject: [PATCH] =?UTF-8?q?:ambulance:=20Fix:=20=EC=9D=8C=EC=8B=9D?= =?UTF-8?q?=EB=AA=85=20=EC=A4=91=EB=B3=B5=EC=97=90=20=EB=8C=80=ED=95=9C=20?= =?UTF-8?q?=EC=98=88=EC=99=B8=EC=B2=98=EB=A6=AC=20=EC=A0=9C=EA=B1=B0=20(#1?= =?UTF-8?q?33)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/diareat/diareat/food/service/FoodService.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/main/java/com/diareat/diareat/food/service/FoodService.java b/src/main/java/com/diareat/diareat/food/service/FoodService.java index 8689bd1..ec4dcae 100644 --- a/src/main/java/com/diareat/diareat/food/service/FoodService.java +++ b/src/main/java/com/diareat/diareat/food/service/FoodService.java @@ -10,19 +10,14 @@ import com.diareat.diareat.user.dto.response.ResponseRankUserDto; import com.diareat.diareat.user.repository.FollowRepository; import com.diareat.diareat.user.repository.UserRepository; -import com.diareat.diareat.util.MessageUtil; import com.diareat.diareat.util.api.ResponseCode; import com.diareat.diareat.util.exception.FavoriteException; import com.diareat.diareat.util.exception.FoodException; import com.diareat.diareat.util.exception.UserException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cglib.core.Local; -import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.cache.annotation.Cacheable; import java.time.DayOfWeek; import java.time.LocalDate; @@ -43,10 +38,6 @@ public class FoodService { // @CacheEvict(value = {"ResponseNutritionSumByDateDto"}, key = "#userId+createFoodDto.getDate()", cacheManager = "diareatCacheManager") @Transactional public Long saveFood(CreateFoodDto createFoodDto) { - if (foodRepository.existsByName(createFoodDto.getName())){ - log.info(createFoodDto.getName() + ": 이미 존재하는 음식 이름입니다."); - throw new FoodException(ResponseCode.FOOD_NAME_ALREADY_EXIST); - } User user = getUserById(createFoodDto.getUserId()); Food food = Food.createFood(createFoodDto.getName(), user, createFoodDto.getBaseNutrition(), createFoodDto.getYear(), createFoodDto.getMonth(), createFoodDto.getDay()); log.info("신규 음식 저장: " + food.getName());