From 5e6a0591d5a16267d4fa85584a1c55acda39eb0d Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Thu, 5 Oct 2023 22:07:39 +0900 Subject: [PATCH 01/15] =?UTF-8?q?:sparkles:=20feat:=207=EC=9D=BC,=201?= =?UTF-8?q?=EA=B0=9C=EC=9B=94=20=EA=B0=84=20=EC=98=81=EC=96=91=EC=84=B1?= =?UTF-8?q?=EB=B6=84=20=EC=B4=9D=ED=95=A9=20=EC=A1=B0=ED=9A=8C=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../food/repository/FoodRepository.java | 1 + .../diareat/food/service/FoodService.java | 64 +++++++++++-------- 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/diareat/diareat/food/repository/FoodRepository.java b/src/main/java/com/diareat/diareat/food/repository/FoodRepository.java index 4c4ef98..5cd6d90 100644 --- a/src/main/java/com/diareat/diareat/food/repository/FoodRepository.java +++ b/src/main/java/com/diareat/diareat/food/repository/FoodRepository.java @@ -8,4 +8,5 @@ public interface FoodRepository extends JpaRepository { List findAllByUserIdAndDate(Long userId, LocalDate date); //유저가 특정 날짜에 먹은 음식 반환 + List findAllByUserIdAndDateBetween(Long userId, LocalDate startDate, LocalDate endDate); //유저가 특정 기간 내에 먹은 음식 반환 } 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 f2db24e..b813e8b 100644 --- a/src/main/java/com/diareat/diareat/food/service/FoodService.java +++ b/src/main/java/com/diareat/diareat/food/service/FoodService.java @@ -94,47 +94,36 @@ public void deleteFavoriteFood(Long favoriteFoodId) { // 유저의 특정 날짜에 먹은 음식들의 영양성분별 총합 조회 (섭취영양소/기준영양소 및 비율까지 계산해서 반환, dto 구체적 협의 필요) public ResponseNutritionSumByDateDto getNutritionSumByDate(Long userId, LocalDate date) { List foodList = foodRepository.findAllByUserIdAndDate(userId, date); - User targetUser = getUserById(userId); - int totalKcal = 0; - int totalCarbohydrate = 0; - int totalProtein = 0; - int totalFat = 0; - - for (Food food : foodList) { - BaseNutrition targetFoodNutrition = food.getBaseNutrition(); - totalKcal += targetFoodNutrition.getKcal(); - totalCarbohydrate += targetFoodNutrition.getCarbohydrate(); - totalProtein += targetFoodNutrition.getProtein(); - totalFat += targetFoodNutrition.getFat(); - } - - double ratioKcal = Math.round((totalKcal*1.0)/(targetUser.getBaseNutrition().getKcal()*1.0))*10.0; - double ratioCarbohydrate = Math.round((totalCarbohydrate*1.0)/(targetUser.getBaseNutrition().getCarbohydrate()*1.0))*10.0; - double ratioProtein = Math.round((totalProtein*1.0)/(targetUser.getBaseNutrition().getProtein()*1.0))*10.0; - double ratioFat = Math.round((totalFat*1.0)/(targetUser.getBaseNutrition().getFat()*1.0))*10.0; - - return ResponseNutritionSumByDateDto.of(totalKcal,totalCarbohydrate, totalProtein, totalFat, ratioKcal, ratioCarbohydrate, ratioProtein, ratioFat); + return calculateNutritionSumAndRatio(userId, foodList); } - @Transactional + @Transactional(readOnly = true) // 유저의 최근 7일간의 영양성분별 총합 조회 (섭취영양소/기준영양소 및 비율까지 계산해서 반환, dto 구체적 협의 필요) - public void getNutritionSumByWeek(Long userId) { + public ResponseNutritionSumByDateDto getNutritionSumByWeek(Long userId) { + LocalDate endDate = LocalDate.now(); + LocalDate startDate = endDate.minusDays(6); + List foodList = foodRepository.findAllByUserIdAndDateBetween(userId, startDate, endDate); + return calculateNutritionSumAndRatio(userId, foodList); } - @Transactional + @Transactional(readOnly = true) // 유저의 최근 1개월간의 영양성분별 총합 조회 (섭취영양소/기준영양소 및 비율까지 계산해서 반환, dto 구체적 협의 필요) - public void getNutritionSumByMonth(Long userId) { + public ResponseNutritionSumByDateDto getNutritionSumByMonth(Long userId) { + LocalDate endDate = LocalDate.now(); + LocalDate startDate = endDate.minusMonths(1); + List foodList = foodRepository.findAllByUserIdAndDateBetween(userId, startDate, endDate); + return calculateNutritionSumAndRatio(userId, foodList); } - @Transactional + @Transactional(readOnly = true) // 유저의 최근 7일간의 Best 3 음식 조회 (dto 구체적 협의 필요) public void getBestFoodByWeek(Long userId) { } - @Transactional + @Transactional(readOnly = true) // 유저의 최근 7일간의 Worst 3 음식 조회 (dto 구체적 협의 필요) public void getWorstFoodByWeek(Long userId) { @@ -155,6 +144,29 @@ private FavoriteFood getFavoriteFoodById(Long foodId){ .orElseThrow(() -> new FoodException(ResponseCode.FOOD_NOT_FOUND)); } + private ResponseNutritionSumByDateDto calculateNutritionSumAndRatio(Long userId, List foodList){ + User targetUser = getUserById(userId); + int totalKcal = 0; + int totalCarbohydrate = 0; + int totalProtein = 0; + int totalFat = 0; + + for (Food food : foodList) { + BaseNutrition targetFoodNutrition = food.getBaseNutrition(); + totalKcal += targetFoodNutrition.getKcal(); + totalCarbohydrate += targetFoodNutrition.getCarbohydrate(); + totalProtein += targetFoodNutrition.getProtein(); + totalFat += targetFoodNutrition.getFat(); + } + + double ratioKcal = Math.round((totalKcal*1.0)/(targetUser.getBaseNutrition().getKcal()*1.0))*10.0; + double ratioCarbohydrate = Math.round((totalCarbohydrate*1.0)/(targetUser.getBaseNutrition().getCarbohydrate()*1.0))*10.0; + double ratioProtein = Math.round((totalProtein*1.0)/(targetUser.getBaseNutrition().getProtein()*1.0))*10.0; + double ratioFat = Math.round((totalFat*1.0)/(targetUser.getBaseNutrition().getFat()*1.0))*10.0; + + return ResponseNutritionSumByDateDto.of(totalKcal,totalCarbohydrate, totalProtein, totalFat, ratioKcal, ratioCarbohydrate, ratioProtein, ratioFat); + } + /** * 메서드 구현 유의사항 From 73441ef4eabb49285e043aa0502ea361dd967d00 Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Wed, 11 Oct 2023 13:29:12 +0900 Subject: [PATCH 02/15] =?UTF-8?q?:bug:=20fix:=20=EC=9E=98=EB=AA=BB?= =?UTF-8?q?=EB=90=9C=20=EC=98=81=EC=96=91=EC=86=8C=20=EB=B9=84=EC=9C=A8=20?= =?UTF-8?q?=EA=B3=84=EC=82=B0=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../diareat/food/service/FoodService.java | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 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 b813e8b..b87a886 100644 --- a/src/main/java/com/diareat/diareat/food/service/FoodService.java +++ b/src/main/java/com/diareat/diareat/food/service/FoodService.java @@ -15,7 +15,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.rmi.registry.LocateRegistry; import java.time.LocalDate; +import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @@ -119,14 +121,32 @@ public ResponseNutritionSumByDateDto getNutritionSumByMonth(Long userId) { @Transactional(readOnly = true) // 유저의 최근 7일간의 Best 3 음식 조회 (dto 구체적 협의 필요) - public void getBestFoodByWeek(Long userId) { + public ResponseFoodRankDto getBestFoodByWeek(Long userId, LocalDate startDate) { + List foodList = foodRepository.findAllByUserIdAndDateBetween(userId, startDate, startDate.minusWeeks(1)); + List top3Foods = foodList.stream() + .sorted(Comparator.comparingDouble((Food food) -> + 0.7 * food.getBaseNutrition().getProtein()- 0.3 * food.getBaseNutrition().getProtein()).reversed()) + .limit(3) + .collect(Collectors.toList()); //고단백 저지방일수록 점수를 높게 측정되도록 기준을 잡은 후, 그 기준을 기반으로 정렬 + //사용한 기준은, 고단백과 저지방의 점수 반영 비율을 7:3으로 측정하고, 단백질량이 높을 수록, 지방량이 낮을 수록 점수가 높음. 이후, 내림차순 정렬 + + return ResponseFoodRankDto.of(userId, top3Foods, startDate, true); } @Transactional(readOnly = true) // 유저의 최근 7일간의 Worst 3 음식 조회 (dto 구체적 협의 필요) - public void getWorstFoodByWeek(Long userId) { + public ResponseFoodRankDto getWorstFoodByWeek(Long userId, LocalDate startDate) { + + List foodList = foodRepository.findAllByUserIdAndDateBetween(userId, startDate, startDate.minusWeeks(1)); + + List worst3Foods = foodList.stream() + .sorted(Comparator.comparingDouble((Food food) -> + 0.7 * food.getBaseNutrition().getProtein()- 0.3 * food.getBaseNutrition().getProtein())) + .limit(3) + .collect(Collectors.toList()); + return ResponseFoodRankDto.of(userId, worst3Foods, startDate, false); } private User getUserById(Long userId){ @@ -159,10 +179,10 @@ private ResponseNutritionSumByDateDto calculateNutritionSumAndRatio(Long userId, totalFat += targetFoodNutrition.getFat(); } - double ratioKcal = Math.round((totalKcal*1.0)/(targetUser.getBaseNutrition().getKcal()*1.0))*10.0; - double ratioCarbohydrate = Math.round((totalCarbohydrate*1.0)/(targetUser.getBaseNutrition().getCarbohydrate()*1.0))*10.0; - double ratioProtein = Math.round((totalProtein*1.0)/(targetUser.getBaseNutrition().getProtein()*1.0))*10.0; - double ratioFat = Math.round((totalFat*1.0)/(targetUser.getBaseNutrition().getFat()*1.0))*10.0; + double ratioKcal = Math.round((((double) totalKcal /(double) targetUser.getBaseNutrition().getKcal())*100.0)*10.0)/10.0; + double ratioCarbohydrate = Math.round((((double) totalCarbohydrate /(double) targetUser.getBaseNutrition().getCarbohydrate())*100.0)*10.0)/10.0; + double ratioProtein = Math.round((((double) totalProtein /(double) targetUser.getBaseNutrition().getProtein())*100.0)*10.0)/10.0; + double ratioFat =Math.round((((double) totalFat /(double) targetUser.getBaseNutrition().getFat())*100.0)*10.0)/10.0; return ResponseNutritionSumByDateDto.of(totalKcal,totalCarbohydrate, totalProtein, totalFat, ratioKcal, ratioCarbohydrate, ratioProtein, ratioFat); } From 13367fb8f2c1c355701241d83b65bdc233f6039e Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Wed, 11 Oct 2023 13:30:56 +0900 Subject: [PATCH 03/15] =?UTF-8?q?:white=5Fcheck=5Fmark:=20test:=20?= =?UTF-8?q?=EC=98=81=EC=96=91=EC=86=8C=20=EB=B9=84=EC=9C=A8=20=EA=B3=84?= =?UTF-8?q?=EC=82=B0=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../diareat/service/FoodServiceTest.java | 49 ++++++++++++++++--- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/src/test/java/com/diareat/diareat/service/FoodServiceTest.java b/src/test/java/com/diareat/diareat/service/FoodServiceTest.java index b633575..e7dfba1 100644 --- a/src/test/java/com/diareat/diareat/service/FoodServiceTest.java +++ b/src/test/java/com/diareat/diareat/service/FoodServiceTest.java @@ -7,6 +7,7 @@ import com.diareat.diareat.food.repository.FoodRepository; import com.diareat.diareat.food.service.FoodService; import com.diareat.diareat.user.domain.BaseNutrition; +import com.diareat.diareat.user.domain.User; import com.diareat.diareat.user.dto.CreateUserDto; import com.diareat.diareat.user.repository.UserRepository; import com.diareat.diareat.user.service.UserService; @@ -17,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.Optional; import static org.junit.jupiter.api.Assertions.*; @@ -153,24 +155,55 @@ void testDeleteFavoriteFood() { @Test void testNutritionSumByDate(){ //given - BaseNutrition testFoodNutrition = BaseNutrition.createNutrition(100,150,200,250); + BaseNutrition testFoodNutrition = BaseNutrition.createNutrition(1400,150,200,250); Long userId = userService.saveUser(CreateUserDto.of("testUser", "testPassword",1, 180, 80, 18)); Long foodId = foodService.saveFood(CreateFoodDto.of(userId,"testFood", testFoodNutrition)); Food food = foodRepository.getReferenceById(foodId); //when ResponseNutritionSumByDateDto responseNutritionSumByDateDto = foodService.getNutritionSumByDate(userId,food.getDate()); - - assertNotNull(responseNutritionSumByDateDto); - assertEquals(100, responseNutritionSumByDateDto.getTotalKcal()); + assertEquals(1400, responseNutritionSumByDateDto.getTotalKcal()); assertEquals(150, responseNutritionSumByDateDto.getTotalCarbohydrate()); assertEquals(200, responseNutritionSumByDateDto.getTotalProtein()); assertEquals(250, responseNutritionSumByDateDto.getTotalFat()); - assertEquals(Math.round((100*1.0)/(2000*1.0))*10.0, responseNutritionSumByDateDto.getRatioKcal()); - assertEquals(Math.round((150*1.0)/(300*1.0))*10.0, responseNutritionSumByDateDto.getRatioCarbohydrate()); - assertEquals(Math.round((200*1.0)/(80*1.0))*10.0, responseNutritionSumByDateDto.getRatioProtein()); - assertEquals(Math.round((250*1.0)/(80*1.0))*10.0, responseNutritionSumByDateDto.getRatioFat()); + assertEquals(Math.round((((double)1400 / (double)2000) * 100.0)*100.0)/100.0, responseNutritionSumByDateDto.getRatioKcal()); + assertEquals(Math.round((((double)150 / (double)300) * 100.0)*100.0)/100.0, responseNutritionSumByDateDto.getRatioCarbohydrate()); + assertEquals(Math.round((((double)200 / (double)80) * 100.0)*100.0)/100.0, responseNutritionSumByDateDto.getRatioProtein()); + assertEquals(Math.round((((double)250 / (double)80) * 100.0)*100.0)/100.0, responseNutritionSumByDateDto.getRatioFat()); + } + @Test + void testNutritionSumByWeekAndMonth(){ + //given + BaseNutrition testFoodNutrition = BaseNutrition.createNutrition(100,150,200,250); + Long userId = userService.saveUser(CreateUserDto.of("testUser", "testPassword",1, 180, 80, 18)); + Long foodId = foodService.saveFood(CreateFoodDto.of(userId,"testFood", testFoodNutrition)); + + } + + @Test + void getTop3HighProteinLowFatFoodsTest() { + // given + Long userId = userService.saveUser(CreateUserDto.of("testUser", "testPassword", 1, 180, 80, 18)); + foodService.saveFood(CreateFoodDto.of(userId, "Food1", BaseNutrition.createNutrition(100, 100 ,10, 1))); + foodService.saveFood(CreateFoodDto.of(userId, "Food2", BaseNutrition.createNutrition(100, 100 ,8, 2))); + foodService.saveFood(CreateFoodDto.of(userId, "Food3", BaseNutrition.createNutrition(100, 100 ,6, 3))); + foodService.saveFood(CreateFoodDto.of(userId, "Food4", BaseNutrition.createNutrition(100, 100 ,4, 4))); + Long foodId = foodService.saveFood(CreateFoodDto.of(userId, "Food5", BaseNutrition.createNutrition(100, 100 ,2, 5))); + + Food testFood = foodRepository.getReferenceById(foodId); +// +// // when +// ResponseNutritionSumByDateDto response = foodService.getNutritionSumByDate(userId, testFood.getDate()); +//// List top3Foods = response.getRankFoodList(); +//// +//// // then +//// assertEquals(3, top3Foods.size()); +//// assertEquals("Food1", top3Foods.get(0).getName()); +//// assertEquals("Food2", top3Foods.get(1).getName()); +//// assertEquals("Food3", top3Foods.get(2).getName()); +// assertNotNull(testFood.getName()); +// assertEquals("Food5", testFood.getDate()); } } From 2b25968aad6827fffd6b85ef8b69211856f21162 Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Wed, 11 Oct 2023 13:32:40 +0900 Subject: [PATCH 04/15] =?UTF-8?q?:sparkles:=20feat:=20=EC=9D=8C=EC=8B=9D?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1=20=EB=82=A0=EC=A7=9C=20=ED=98=84=EC=9E=AC?= =?UTF-8?q?=20=EB=82=A0=EC=A7=9C=EB=A1=9C=20=EC=88=98=EC=A0=95=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/diareat/diareat/food/domain/Food.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/diareat/diareat/food/domain/Food.java b/src/main/java/com/diareat/diareat/food/domain/Food.java index 7b98ef5..490f4da 100644 --- a/src/main/java/com/diareat/diareat/food/domain/Food.java +++ b/src/main/java/com/diareat/diareat/food/domain/Food.java @@ -42,6 +42,7 @@ public static Food createFood(String name, User user, BaseNutrition baseNutritio Food food = new Food(); food.name = name; food.user = user; + food.date = LocalDate.now(); food.time = LocalTime.now(); food.baseNutrition = baseNutrition; return food; From 85edad8dd6c3b9af868f40ea058f6b7af3f7a283 Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Wed, 11 Oct 2023 13:42:14 +0900 Subject: [PATCH 05/15] =?UTF-8?q?:bug:=20fix:=20=EC=9E=98=EB=AA=BB?= =?UTF-8?q?=EB=90=9C=20=EB=82=A0=EC=A7=9C=20=EA=B8=B0=EA=B0=84=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=88=98=EC=A0=95=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../diareat/diareat/food/service/FoodService.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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 b87a886..a622fdc 100644 --- a/src/main/java/com/diareat/diareat/food/service/FoodService.java +++ b/src/main/java/com/diareat/diareat/food/service/FoodService.java @@ -121,8 +121,8 @@ public ResponseNutritionSumByDateDto getNutritionSumByMonth(Long userId) { @Transactional(readOnly = true) // 유저의 최근 7일간의 Best 3 음식 조회 (dto 구체적 협의 필요) - public ResponseFoodRankDto getBestFoodByWeek(Long userId, LocalDate startDate) { - List foodList = foodRepository.findAllByUserIdAndDateBetween(userId, startDate, startDate.minusWeeks(1)); + public ResponseFoodRankDto getBestFoodByWeek(Long userId, LocalDate endDate) { + List foodList = foodRepository.findAllByUserIdAndDateBetween(userId, endDate.minusWeeks(1), endDate); List top3Foods = foodList.stream() .sorted(Comparator.comparingDouble((Food food) -> @@ -131,14 +131,14 @@ public ResponseFoodRankDto getBestFoodByWeek(Long userId, LocalDate startDate) { .collect(Collectors.toList()); //고단백 저지방일수록 점수를 높게 측정되도록 기준을 잡은 후, 그 기준을 기반으로 정렬 //사용한 기준은, 고단백과 저지방의 점수 반영 비율을 7:3으로 측정하고, 단백질량이 높을 수록, 지방량이 낮을 수록 점수가 높음. 이후, 내림차순 정렬 - return ResponseFoodRankDto.of(userId, top3Foods, startDate, true); + return ResponseFoodRankDto.of(userId, top3Foods, endDate, true); } @Transactional(readOnly = true) // 유저의 최근 7일간의 Worst 3 음식 조회 (dto 구체적 협의 필요) - public ResponseFoodRankDto getWorstFoodByWeek(Long userId, LocalDate startDate) { + public ResponseFoodRankDto getWorstFoodByWeek(Long userId, LocalDate endDate) { - List foodList = foodRepository.findAllByUserIdAndDateBetween(userId, startDate, startDate.minusWeeks(1)); + List foodList = foodRepository.findAllByUserIdAndDateBetween(userId, endDate.minusWeeks(1), endDate); List worst3Foods = foodList.stream() .sorted(Comparator.comparingDouble((Food food) -> @@ -146,7 +146,7 @@ public ResponseFoodRankDto getWorstFoodByWeek(Long userId, LocalDate startDate) .limit(3) .collect(Collectors.toList()); - return ResponseFoodRankDto.of(userId, worst3Foods, startDate, false); + return ResponseFoodRankDto.of(userId, worst3Foods, endDate, false); } private User getUserById(Long userId){ From 05d85dd9f62b00a68c0117bd2a2079838eb02059 Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Wed, 11 Oct 2023 13:45:40 +0900 Subject: [PATCH 06/15] =?UTF-8?q?:sparkles:=20feat:=20Worst=203=20?= =?UTF-8?q?=EC=9D=8C=EC=8B=9D=20=EC=A1=B0=ED=9A=8C=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 고지방, 고탄수 --- .../java/com/diareat/diareat/food/service/FoodService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 a622fdc..1a6b40f 100644 --- a/src/main/java/com/diareat/diareat/food/service/FoodService.java +++ b/src/main/java/com/diareat/diareat/food/service/FoodService.java @@ -142,9 +142,10 @@ public ResponseFoodRankDto getWorstFoodByWeek(Long userId, LocalDate endDate) { List worst3Foods = foodList.stream() .sorted(Comparator.comparingDouble((Food food) -> - 0.7 * food.getBaseNutrition().getProtein()- 0.3 * food.getBaseNutrition().getProtein())) + 0.7 * food.getBaseNutrition().getFat() + 0.3 * food.getBaseNutrition().getCarbohydrate()).reversed()) .limit(3) .collect(Collectors.toList()); + //반대로 고지방 고탄수의 경우를 7:3으로 측정하고, 지방이 높을 수록 점수가 급격히 높아짐. 이 경우는 점수가 높은 것이 안좋음. return ResponseFoodRankDto.of(userId, worst3Foods, endDate, false); } From 14c8223af7ab1dbb0efda18a310f77f67c9e768e Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Wed, 11 Oct 2023 13:46:02 +0900 Subject: [PATCH 07/15] =?UTF-8?q?:sparkles:=20feat:=20Best,=20Worst=20?= =?UTF-8?q?=EC=9D=8C=EC=8B=9D=20=EC=84=A0=EC=A0=95=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?=EC=9E=84=EC=8B=9C=20Dto=20=EA=B5=AC=ED=98=84=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../diareat/food/dto/ResponseFoodRankDto.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/main/java/com/diareat/diareat/food/dto/ResponseFoodRankDto.java diff --git a/src/main/java/com/diareat/diareat/food/dto/ResponseFoodRankDto.java b/src/main/java/com/diareat/diareat/food/dto/ResponseFoodRankDto.java new file mode 100644 index 0000000..6f32f5f --- /dev/null +++ b/src/main/java/com/diareat/diareat/food/dto/ResponseFoodRankDto.java @@ -0,0 +1,24 @@ +package com.diareat.diareat.food.dto; + +import com.diareat.diareat.food.domain.Food; +import com.diareat.diareat.user.domain.BaseNutrition; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.time.LocalDate; +import java.time.LocalTime; +import java.util.List; + +@Getter +@AllArgsConstructor +public class ResponseFoodRankDto { + + private Long userId; + private List rankFoodList; + private LocalDate startDate; //해당 날짜로부터 7일전까지 + private boolean isBest; //isBest = true 이면 Best 3, false 이면 Worst 3 + + public static ResponseFoodRankDto of(Long userId, List rankFoodList, LocalDate startDate, boolean isBest) { + return new ResponseFoodRankDto(userId, rankFoodList, startDate, isBest); + } +} From fe650909adff575b348583b60301439847dbdfda Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Wed, 11 Oct 2023 13:58:16 +0900 Subject: [PATCH 08/15] =?UTF-8?q?:bulb:=20chore:=20Best3,=20Worst3=20?= =?UTF-8?q?=EC=84=A0=EC=A0=95=20=EA=B8=B0=EC=A4=80=20=EB=85=BC=EC=9D=98=20?= =?UTF-8?q?=EC=A3=BC=EC=84=9D=20=EC=B6=94=EA=B0=80=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/diareat/diareat/food/service/FoodService.java | 4 ++++ 1 file changed, 4 insertions(+) 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 1a6b40f..3222f7a 100644 --- a/src/main/java/com/diareat/diareat/food/service/FoodService.java +++ b/src/main/java/com/diareat/diareat/food/service/FoodService.java @@ -130,6 +130,7 @@ public ResponseFoodRankDto getBestFoodByWeek(Long userId, LocalDate endDate) { .limit(3) .collect(Collectors.toList()); //고단백 저지방일수록 점수를 높게 측정되도록 기준을 잡은 후, 그 기준을 기반으로 정렬 //사용한 기준은, 고단백과 저지방의 점수 반영 비율을 7:3으로 측정하고, 단백질량이 높을 수록, 지방량이 낮을 수록 점수가 높음. 이후, 내림차순 정렬 + // ** Best 3 기준 논의 필요 ** return ResponseFoodRankDto.of(userId, top3Foods, endDate, true); } @@ -146,6 +147,9 @@ public ResponseFoodRankDto getWorstFoodByWeek(Long userId, LocalDate endDate) { .limit(3) .collect(Collectors.toList()); //반대로 고지방 고탄수의 경우를 7:3으로 측정하고, 지방이 높을 수록 점수가 급격히 높아짐. 이 경우는 점수가 높은 것이 안좋음. + //(수정) https://blog.nongshim.com/1961, 탄수화물이 더 영향을 미친다고 하는데...흠... + // ** 이점은 논의가 필요할 듯? ** + // 우선 임시로 지방 비율을 높게 설정 return ResponseFoodRankDto.of(userId, worst3Foods, endDate, false); } From dfb25036f819134000c023abb1108d9f2d990924 Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Wed, 11 Oct 2023 13:58:39 +0900 Subject: [PATCH 09/15] =?UTF-8?q?:white=5Fcheck=5Fmark:=20test:=20Worst3?= =?UTF-8?q?=20=EC=84=A0=EC=A0=95=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EA=B5=AC=ED=98=84=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../diareat/service/FoodServiceTest.java | 47 ++++++++++++++----- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/src/test/java/com/diareat/diareat/service/FoodServiceTest.java b/src/test/java/com/diareat/diareat/service/FoodServiceTest.java index e7dfba1..242d875 100644 --- a/src/test/java/com/diareat/diareat/service/FoodServiceTest.java +++ b/src/test/java/com/diareat/diareat/service/FoodServiceTest.java @@ -183,7 +183,7 @@ void testNutritionSumByWeekAndMonth(){ } @Test - void getTop3HighProteinLowFatFoodsTest() { + void getBest3FoodTest() { // given Long userId = userService.saveUser(CreateUserDto.of("testUser", "testPassword", 1, 180, 80, 18)); foodService.saveFood(CreateFoodDto.of(userId, "Food1", BaseNutrition.createNutrition(100, 100 ,10, 1))); @@ -193,17 +193,38 @@ void getTop3HighProteinLowFatFoodsTest() { Long foodId = foodService.saveFood(CreateFoodDto.of(userId, "Food5", BaseNutrition.createNutrition(100, 100 ,2, 5))); Food testFood = foodRepository.getReferenceById(foodId); -// -// // when -// ResponseNutritionSumByDateDto response = foodService.getNutritionSumByDate(userId, testFood.getDate()); -//// List top3Foods = response.getRankFoodList(); -//// -//// // then -//// assertEquals(3, top3Foods.size()); -//// assertEquals("Food1", top3Foods.get(0).getName()); -//// assertEquals("Food2", top3Foods.get(1).getName()); -//// assertEquals("Food3", top3Foods.get(2).getName()); -// assertNotNull(testFood.getName()); -// assertEquals("Food5", testFood.getDate()); + + // when + ResponseFoodRankDto response = foodService.getBestFoodByWeek(userId, testFood.getDate()); + List top3Foods = response.getRankFoodList(); + + // then + assertEquals(3, top3Foods.size()); + assertEquals("Food1", top3Foods.get(0).getName()); + assertEquals("Food2", top3Foods.get(1).getName()); + assertEquals("Food3", top3Foods.get(2).getName()); + } + + @Test + void getWorst3FoodsTest() { + // given + Long userId = userService.saveUser(CreateUserDto.of("testUser", "testPassword", 1, 180, 80, 18)); + foodService.saveFood(CreateFoodDto.of(userId, "Food1", BaseNutrition.createNutrition(100, 50 ,10, 1))); + foodService.saveFood(CreateFoodDto.of(userId, "Food2", BaseNutrition.createNutrition(100, 100 ,8, 20))); + foodService.saveFood(CreateFoodDto.of(userId, "Food3", BaseNutrition.createNutrition(100, 80 ,6, 7))); + foodService.saveFood(CreateFoodDto.of(userId, "Food4", BaseNutrition.createNutrition(100, 100 ,4, 5))); + Long foodId = foodService.saveFood(CreateFoodDto.of(userId, "Food5", BaseNutrition.createNutrition(100, 90 ,2, 6))); + + Food testFood = foodRepository.getReferenceById(foodId); + + // when + ResponseFoodRankDto response = foodService.getWorstFoodByWeek(userId, testFood.getDate()); + List top3Foods = response.getRankFoodList(); + + // then + assertEquals(3, top3Foods.size()); + assertEquals("Food2", top3Foods.get(0).getName()); + assertEquals("Food4", top3Foods.get(1).getName()); + assertEquals("Food5", top3Foods.get(2).getName()); } } From f2ecba087ea37ca2d021882b7e260c3a218bf283 Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Wed, 11 Oct 2023 14:07:16 +0900 Subject: [PATCH 10/15] =?UTF-8?q?:pencil2:=20fix:=20Best3=20=EC=84=A0?= =?UTF-8?q?=EC=A0=95=20=EA=B8=B0=EC=A4=80=EC=97=90=EC=84=9C=20getProtein()?= =?UTF-8?q?=20->=20getFat()=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/diareat/diareat/food/service/FoodService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3222f7a..d8aca7f 100644 --- a/src/main/java/com/diareat/diareat/food/service/FoodService.java +++ b/src/main/java/com/diareat/diareat/food/service/FoodService.java @@ -126,7 +126,7 @@ public ResponseFoodRankDto getBestFoodByWeek(Long userId, LocalDate endDate) { List top3Foods = foodList.stream() .sorted(Comparator.comparingDouble((Food food) -> - 0.7 * food.getBaseNutrition().getProtein()- 0.3 * food.getBaseNutrition().getProtein()).reversed()) + 0.7 * food.getBaseNutrition().getProtein()- 0.3 * food.getBaseNutrition().getFat()).reversed()) .limit(3) .collect(Collectors.toList()); //고단백 저지방일수록 점수를 높게 측정되도록 기준을 잡은 후, 그 기준을 기반으로 정렬 //사용한 기준은, 고단백과 저지방의 점수 반영 비율을 7:3으로 측정하고, 단백질량이 높을 수록, 지방량이 낮을 수록 점수가 높음. 이후, 내림차순 정렬 From ea0adcb1f4e632e3bbff253419108230db3e49f8 Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Wed, 11 Oct 2023 14:19:11 +0900 Subject: [PATCH 11/15] =?UTF-8?q?:recycle:=20refactor:=20=EC=98=81?= =?UTF-8?q?=EC=96=91=EC=84=B1=EB=B6=84=20=EC=B4=9D=ED=95=A9=20Dto=20?= =?UTF-8?q?=EC=A4=91=20=EB=88=84=EB=9D=BD=EB=90=9C=20=EC=86=8D=EC=84=B1=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../food/dto/ResponseNutritionSumByDateDto.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/diareat/diareat/food/dto/ResponseNutritionSumByDateDto.java b/src/main/java/com/diareat/diareat/food/dto/ResponseNutritionSumByDateDto.java index 5eb8e4c..1520eb4 100644 --- a/src/main/java/com/diareat/diareat/food/dto/ResponseNutritionSumByDateDto.java +++ b/src/main/java/com/diareat/diareat/food/dto/ResponseNutritionSumByDateDto.java @@ -3,9 +3,16 @@ import lombok.AllArgsConstructor; import lombok.Getter; +import java.time.LocalDate; + @Getter @AllArgsConstructor public class ResponseNutritionSumByDateDto { + + Long userId; + LocalDate checkDate; //조회한 날짜 + int nutritionSumType; //조회할 기간을 나타내는 코드. {1: 특정 날짜, 7: 최근 7일간, 30: 최근 한달간} + int totalKcal; int totalCarbohydrate; int totalProtein; @@ -16,7 +23,7 @@ public class ResponseNutritionSumByDateDto { double ratioProtein; double ratioFat; - public static ResponseNutritionSumByDateDto of (int totalKcal, int totalCarbohydrate, int totalProtein, int totalFat, double ratioKcal, double ratioCarbohydrate, double ratioProtein, double ratioFat){ - return new ResponseNutritionSumByDateDto(totalKcal, totalCarbohydrate, totalProtein, totalFat, ratioKcal, ratioCarbohydrate, ratioProtein, ratioFat); + public static ResponseNutritionSumByDateDto of (Long userId, LocalDate checkDate, int nutritionSumType, int totalKcal, int totalCarbohydrate, int totalProtein, int totalFat, double ratioKcal, double ratioCarbohydrate, double ratioProtein, double ratioFat){ + return new ResponseNutritionSumByDateDto(userId, checkDate, nutritionSumType, totalKcal, totalCarbohydrate, totalProtein, totalFat, ratioKcal, ratioCarbohydrate, ratioProtein, ratioFat); } } From ce61bdd0dc12479c7fdaef137bd7c0755218a2df Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Wed, 11 Oct 2023 14:23:19 +0900 Subject: [PATCH 12/15] =?UTF-8?q?:recycle:=20refactor:=20Dto=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=98=81=EC=96=91?= =?UTF-8?q?=EC=84=B1=EB=B6=84=20=ED=95=A9=20=EC=A1=B0=ED=9A=8C=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../diareat/food/service/FoodService.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 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 d8aca7f..f7d5494 100644 --- a/src/main/java/com/diareat/diareat/food/service/FoodService.java +++ b/src/main/java/com/diareat/diareat/food/service/FoodService.java @@ -96,27 +96,25 @@ public void deleteFavoriteFood(Long favoriteFoodId) { // 유저의 특정 날짜에 먹은 음식들의 영양성분별 총합 조회 (섭취영양소/기준영양소 및 비율까지 계산해서 반환, dto 구체적 협의 필요) public ResponseNutritionSumByDateDto getNutritionSumByDate(Long userId, LocalDate date) { List foodList = foodRepository.findAllByUserIdAndDate(userId, date); - return calculateNutritionSumAndRatio(userId, foodList); + return calculateNutritionSumAndRatio(userId, foodList, date, 1); } @Transactional(readOnly = true) // 유저의 최근 7일간의 영양성분별 총합 조회 (섭취영양소/기준영양소 및 비율까지 계산해서 반환, dto 구체적 협의 필요) public ResponseNutritionSumByDateDto getNutritionSumByWeek(Long userId) { LocalDate endDate = LocalDate.now(); - LocalDate startDate = endDate.minusDays(6); - List foodList = foodRepository.findAllByUserIdAndDateBetween(userId, startDate, endDate); + List foodList = foodRepository.findAllByUserIdAndDateBetween(userId, endDate.minusWeeks(1), endDate); - return calculateNutritionSumAndRatio(userId, foodList); + return calculateNutritionSumAndRatio(userId, foodList, endDate, 7); } @Transactional(readOnly = true) // 유저의 최근 1개월간의 영양성분별 총합 조회 (섭취영양소/기준영양소 및 비율까지 계산해서 반환, dto 구체적 협의 필요) public ResponseNutritionSumByDateDto getNutritionSumByMonth(Long userId) { LocalDate endDate = LocalDate.now(); - LocalDate startDate = endDate.minusMonths(1); - List foodList = foodRepository.findAllByUserIdAndDateBetween(userId, startDate, endDate); + List foodList = foodRepository.findAllByUserIdAndDateBetween(userId, endDate.minusWeeks(1), endDate); - return calculateNutritionSumAndRatio(userId, foodList); + return calculateNutritionSumAndRatio(userId, foodList, endDate, 30); } @Transactional(readOnly = true) @@ -169,7 +167,7 @@ private FavoriteFood getFavoriteFoodById(Long foodId){ .orElseThrow(() -> new FoodException(ResponseCode.FOOD_NOT_FOUND)); } - private ResponseNutritionSumByDateDto calculateNutritionSumAndRatio(Long userId, List foodList){ + private ResponseNutritionSumByDateDto calculateNutritionSumAndRatio(Long userId, List foodList, LocalDate checkDate, int nutritionSumType){ User targetUser = getUserById(userId); int totalKcal = 0; int totalCarbohydrate = 0; @@ -189,7 +187,7 @@ private ResponseNutritionSumByDateDto calculateNutritionSumAndRatio(Long userId, double ratioProtein = Math.round((((double) totalProtein /(double) targetUser.getBaseNutrition().getProtein())*100.0)*10.0)/10.0; double ratioFat =Math.round((((double) totalFat /(double) targetUser.getBaseNutrition().getFat())*100.0)*10.0)/10.0; - return ResponseNutritionSumByDateDto.of(totalKcal,totalCarbohydrate, totalProtein, totalFat, ratioKcal, ratioCarbohydrate, ratioProtein, ratioFat); + return ResponseNutritionSumByDateDto.of(userId, checkDate, nutritionSumType, totalKcal,totalCarbohydrate, totalProtein, totalFat, ratioKcal, ratioCarbohydrate, ratioProtein, ratioFat); } From dc44397477734c59e04fe44c36b84142b1f9fe6e Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Wed, 11 Oct 2023 15:30:05 +0900 Subject: [PATCH 13/15] =?UTF-8?q?:recycle:=20refactor:=20ResponseFoodRankD?= =?UTF-8?q?to=EC=97=90=EC=84=9C=20Food=20Domain=20->=20Dto=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../diareat/diareat/food/dto/ResponseFoodRankDto.java | 4 ++-- .../com/diareat/diareat/food/service/FoodService.java | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/diareat/diareat/food/dto/ResponseFoodRankDto.java b/src/main/java/com/diareat/diareat/food/dto/ResponseFoodRankDto.java index 6f32f5f..03d74b8 100644 --- a/src/main/java/com/diareat/diareat/food/dto/ResponseFoodRankDto.java +++ b/src/main/java/com/diareat/diareat/food/dto/ResponseFoodRankDto.java @@ -14,11 +14,11 @@ public class ResponseFoodRankDto { private Long userId; - private List rankFoodList; + private List rankFoodList; private LocalDate startDate; //해당 날짜로부터 7일전까지 private boolean isBest; //isBest = true 이면 Best 3, false 이면 Worst 3 - public static ResponseFoodRankDto of(Long userId, List rankFoodList, LocalDate startDate, boolean isBest) { + public static ResponseFoodRankDto of(Long userId, List rankFoodList, LocalDate startDate, boolean isBest) { return new ResponseFoodRankDto(userId, rankFoodList, startDate, isBest); } } 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 f7d5494..2d7c637 100644 --- a/src/main/java/com/diareat/diareat/food/service/FoodService.java +++ b/src/main/java/com/diareat/diareat/food/service/FoodService.java @@ -130,7 +130,10 @@ public ResponseFoodRankDto getBestFoodByWeek(Long userId, LocalDate endDate) { //사용한 기준은, 고단백과 저지방의 점수 반영 비율을 7:3으로 측정하고, 단백질량이 높을 수록, 지방량이 낮을 수록 점수가 높음. 이후, 내림차순 정렬 // ** Best 3 기준 논의 필요 ** - return ResponseFoodRankDto.of(userId, top3Foods, endDate, true); + List top3FoodsDtoList = top3Foods.stream() + .map(food -> ResponseFoodDto.of(food.getId(), food.getUser().getId(), food.getName(), food.getDate(), food.getTime(), food.getBaseNutrition(), food.isFavorite())).collect(Collectors.toList()); + + return ResponseFoodRankDto.of(userId, top3FoodsDtoList, endDate, true); } @Transactional(readOnly = true) @@ -149,7 +152,11 @@ public ResponseFoodRankDto getWorstFoodByWeek(Long userId, LocalDate endDate) { // ** 이점은 논의가 필요할 듯? ** // 우선 임시로 지방 비율을 높게 설정 - return ResponseFoodRankDto.of(userId, worst3Foods, endDate, false); + List worst3FoodDtoList = worst3Foods.stream() + .map(food -> ResponseFoodDto.of(food.getId(), food.getUser().getId(), food.getName(), food.getDate(), food.getTime(), food.getBaseNutrition(), food.isFavorite())).collect(Collectors.toList()); + + + return ResponseFoodRankDto.of(userId, worst3FoodDtoList, endDate, false); } private User getUserById(Long userId){ From d19b639765b89fe797d8b041640ce718470052be Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Wed, 11 Oct 2023 15:31:29 +0900 Subject: [PATCH 14/15] =?UTF-8?q?:white=5Fcheck=5Fmark:=20test:=20Dto?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95=EC=97=90=20=EB=94=B0=EB=A5=B8=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/diareat/diareat/service/FoodServiceTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/diareat/diareat/service/FoodServiceTest.java b/src/test/java/com/diareat/diareat/service/FoodServiceTest.java index 242d875..904899c 100644 --- a/src/test/java/com/diareat/diareat/service/FoodServiceTest.java +++ b/src/test/java/com/diareat/diareat/service/FoodServiceTest.java @@ -196,7 +196,7 @@ void getBest3FoodTest() { // when ResponseFoodRankDto response = foodService.getBestFoodByWeek(userId, testFood.getDate()); - List top3Foods = response.getRankFoodList(); + List top3Foods = response.getRankFoodList(); // then assertEquals(3, top3Foods.size()); @@ -219,7 +219,7 @@ void getWorst3FoodsTest() { // when ResponseFoodRankDto response = foodService.getWorstFoodByWeek(userId, testFood.getDate()); - List top3Foods = response.getRankFoodList(); + List top3Foods = response.getRankFoodList(); // then assertEquals(3, top3Foods.size()); From 9faba4c9f5b5dc45a2f77f67ced2b7a5a2f31c85 Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Wed, 11 Oct 2023 15:33:07 +0900 Subject: [PATCH 15/15] =?UTF-8?q?:recycle:=20refactor:=20CreatedDate=20?= =?UTF-8?q?=EC=96=B4=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/diareat/diareat/food/domain/Food.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/diareat/diareat/food/domain/Food.java b/src/main/java/com/diareat/diareat/food/domain/Food.java index 490f4da..851c5e5 100644 --- a/src/main/java/com/diareat/diareat/food/domain/Food.java +++ b/src/main/java/com/diareat/diareat/food/domain/Food.java @@ -30,7 +30,6 @@ public class Food { @JoinColumn(name = "favorite_food_id") private FavoriteFood favoriteFood; - @CreatedDate private LocalDate date; private LocalTime time;