Skip to content

Commit

Permalink
Merge pull request #67 from CAUSOLDOUTMEN/feature/66-fix-hotfix
Browse files Browse the repository at this point in the history
Fix: 오늘의영양 응답데이터 LocalDate 주석처리 (#66)
  • Loading branch information
win-luck authored Nov 10, 2023
2 parents 8fe48ad + 20103b6 commit aeb1e83
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
import com.diareat.diareat.user.domain.BaseNutrition;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDate;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class ResponseNutritionSumByDateDto {
public class ResponseNutritionSumByDateDto implements Serializable {

Long userId;
LocalDate checkDate; //조회한 날짜
// LocalDate checkDate; //조회한 날짜
int nutritionSumType; //조회할 기간을 나타내는 코드. {1: 특정 날짜, 7: 최근 7일간, 30: 최근 한달간}

int totalKcal;
Expand All @@ -30,7 +33,7 @@ public static ResponseNutritionSumByDateDto of (Long userId, LocalDate checkDate
int totalCarbohydrate, int totalProtein, int totalFat, double ratioKcal,
double ratioCarbohydrate, double ratioProtein, double ratioFat,
BaseNutrition baseNutrition){
return new ResponseNutritionSumByDateDto(userId, checkDate, nutritionSumType, totalKcal,
return new ResponseNutritionSumByDateDto(userId, nutritionSumType, totalKcal,
totalCarbohydrate, totalProtein, totalFat, ratioKcal,
ratioCarbohydrate, ratioProtein, ratioFat, baseNutrition);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void deleteFavoriteFood(Long favoriteFoodId, Long userId) {
favoriteFoodRepository.deleteById(favoriteFoodId);
}

@Cacheable(value = "ResponseNutritionSumByDateDto", key = "#userId+#date.toString()", cacheManager = "diareatCacheManager")
@Cacheable(value = "ResponseNutritionSumByDateDto", key = "#userId + #date.toString()", cacheManager = "diareatCacheManager")
@Transactional(readOnly = true)
// 유저의 특정 날짜에 먹은 음식들의 영양성분별 총합 조회 (섭취영양소/기준영양소 및 비율까지 계산해서 반환, dto 구체적 협의 필요)
public ResponseNutritionSumByDateDto getNutritionSumByDate(Long userId, LocalDate date) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ void testGetNutritionSumByDate() throws Exception{
.andExpect(MockMvcResultMatchers.jsonPath("$.header.code").value(expectedResponse.getHeader().getCode()))
.andExpect(MockMvcResultMatchers.jsonPath("$.header.message").value(expectedResponse.getHeader().getMessage()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.userId").value(expectedResponse.getData().getUserId()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.checkDate").value(expectedResponse.getData().getCheckDate().toString()))
//.andExpect(MockMvcResultMatchers.jsonPath("$.data.checkDate").value(expectedResponse.getData().getCheckDate().toString()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.nutritionSumType").value(expectedResponse.getData().getNutritionSumType()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.totalKcal").value(expectedResponse.getData().getTotalKcal()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.totalCarbohydrate").value(expectedResponse.getData().getTotalCarbohydrate()))
Expand Down Expand Up @@ -308,7 +308,7 @@ void testGetNutritionSumByWeek() throws Exception {
.andExpect(MockMvcResultMatchers.jsonPath("$.header.code").value(expectedResponse.getHeader().getCode()))
.andExpect(MockMvcResultMatchers.jsonPath("$.header.message").value(expectedResponse.getHeader().getMessage()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.userId").value(expectedResponse.getData().getUserId()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.checkDate").value(expectedResponse.getData().getCheckDate().toString()))
//.andExpect(MockMvcResultMatchers.jsonPath("$.data.checkDate").value(expectedResponse.getData().getCheckDate().toString()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.nutritionSumType").value(expectedResponse.getData().getNutritionSumType()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.totalKcal").value(expectedResponse.getData().getTotalKcal()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.totalCarbohydrate").value(expectedResponse.getData().getTotalCarbohydrate()))
Expand Down Expand Up @@ -343,7 +343,7 @@ void testGetNutritionSumByMonth() throws Exception {
.andExpect(MockMvcResultMatchers.jsonPath("$.header.code").value(expectedResponse.getHeader().getCode()))
.andExpect(MockMvcResultMatchers.jsonPath("$.header.message").value(expectedResponse.getHeader().getMessage()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.userId").value(expectedResponse.getData().getUserId()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.checkDate").value(expectedResponse.getData().getCheckDate().toString()))
//.andExpect(MockMvcResultMatchers.jsonPath("$.data.checkDate").value(expectedResponse.getData().getCheckDate().toString()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.nutritionSumType").value(expectedResponse.getData().getNutritionSumType()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.totalKcal").value(expectedResponse.getData().getTotalKcal()))
.andExpect(MockMvcResultMatchers.jsonPath("$.data.totalCarbohydrate").value(expectedResponse.getData().getTotalCarbohydrate()))
Expand Down

0 comments on commit aeb1e83

Please sign in to comment.