From e7ffa1b303dd588cc9914d24ef6bbc2cd03a3cfc Mon Sep 17 00:00:00 2001 From: koo995 <107671886+koo995@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:51:19 +0900 Subject: [PATCH] =?UTF-8?q?rename:=20Diary=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=ED=81=B4=EB=9E=98=EC=8A=A4=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flab/nutridiary/diary/controller/DiaryController.java | 6 +++--- ...etrievalRepository.java => DiarySearchRepository.java} | 2 +- ...sitory.java => JdbcTemplateDiarySearchRepository.java} | 4 ++-- ...DiaryRetrievalService.java => DiarySearchService.java} | 8 ++++---- ...RepositoryTest.java => DiarySearchRepositoryTest.java} | 6 +++--- ...rievalServiceTest.java => DiarySearchServiceTest.java} | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) rename src/main/java/flab/nutridiary/diary/repository/{DiaryRetrievalRepository.java => DiarySearchRepository.java} (86%) rename src/main/java/flab/nutridiary/diary/repository/query/{JdbcTemplateDiaryRetrievalRepository.java => JdbcTemplateDiarySearchRepository.java} (91%) rename src/main/java/flab/nutridiary/diary/service/{DiaryRetrievalService.java => DiarySearchService.java} (63%) rename src/test/java/flab/nutridiary/diary/repository/{DiaryRetrievalRepositoryTest.java => DiarySearchRepositoryTest.java} (95%) rename src/test/java/flab/nutridiary/diary/service/{DiaryRetrievalServiceTest.java => DiarySearchServiceTest.java} (96%) diff --git a/src/main/java/flab/nutridiary/diary/controller/DiaryController.java b/src/main/java/flab/nutridiary/diary/controller/DiaryController.java index 20c0221..4f79176 100644 --- a/src/main/java/flab/nutridiary/diary/controller/DiaryController.java +++ b/src/main/java/flab/nutridiary/diary/controller/DiaryController.java @@ -7,7 +7,7 @@ import flab.nutridiary.diary.dto.response.query.DiaryRecordWithProduct; import flab.nutridiary.diary.service.AddDiaryRecordService; import flab.nutridiary.diary.service.DiaryRegisterService; -import flab.nutridiary.diary.service.DiaryRetrievalService; +import flab.nutridiary.diary.service.DiarySearchService; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; @@ -20,7 +20,7 @@ public class DiaryController { private final DiaryRegisterService diaryRegisterService; private final AddDiaryRecordService addDiaryRecordService; - private final DiaryRetrievalService diaryRetrievalService; + private final DiarySearchService diarySearchService; @PostMapping("/diary/new") public ApiResponse createDiary(@Valid @RequestBody DiaryRegisterRequest diaryRegisterRequest) { @@ -36,6 +36,6 @@ public ApiResponse addDiaryRecord(@Valid @RequestBody AddDia @GetMapping("/diary") public ApiResponse> getDiary(@RequestParam(name = "diaryDate") LocalDate diaryDate) { Long memberId = 1L; - return ApiResponse.success(diaryRetrievalService.getDiary(memberId, diaryDate)); + return ApiResponse.success(diarySearchService.getDiary(memberId, diaryDate)); } } diff --git a/src/main/java/flab/nutridiary/diary/repository/DiaryRetrievalRepository.java b/src/main/java/flab/nutridiary/diary/repository/DiarySearchRepository.java similarity index 86% rename from src/main/java/flab/nutridiary/diary/repository/DiaryRetrievalRepository.java rename to src/main/java/flab/nutridiary/diary/repository/DiarySearchRepository.java index e82db5e..0e22cbc 100644 --- a/src/main/java/flab/nutridiary/diary/repository/DiaryRetrievalRepository.java +++ b/src/main/java/flab/nutridiary/diary/repository/DiarySearchRepository.java @@ -5,6 +5,6 @@ import java.time.LocalDate; import java.util.List; -public interface DiaryRetrievalRepository { +public interface DiarySearchRepository { List findDiaryWithProductAllByMemberIdAndDiaryDate(Long memberId, LocalDate diaryDate); } diff --git a/src/main/java/flab/nutridiary/diary/repository/query/JdbcTemplateDiaryRetrievalRepository.java b/src/main/java/flab/nutridiary/diary/repository/query/JdbcTemplateDiarySearchRepository.java similarity index 91% rename from src/main/java/flab/nutridiary/diary/repository/query/JdbcTemplateDiaryRetrievalRepository.java rename to src/main/java/flab/nutridiary/diary/repository/query/JdbcTemplateDiarySearchRepository.java index 53632be..0c6c668 100644 --- a/src/main/java/flab/nutridiary/diary/repository/query/JdbcTemplateDiaryRetrievalRepository.java +++ b/src/main/java/flab/nutridiary/diary/repository/query/JdbcTemplateDiarySearchRepository.java @@ -1,7 +1,7 @@ package flab.nutridiary.diary.repository.query; import flab.nutridiary.diary.dto.response.query.DiaryRecordWithProduct; -import flab.nutridiary.diary.repository.DiaryRetrievalRepository; +import flab.nutridiary.diary.repository.DiarySearchRepository; import lombok.RequiredArgsConstructor; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; @@ -12,7 +12,7 @@ @Repository @RequiredArgsConstructor -public class JdbcTemplateDiaryRetrievalRepository implements DiaryRetrievalRepository { +public class JdbcTemplateDiarySearchRepository implements DiarySearchRepository { private final NamedParameterJdbcTemplate namedParameterJdbcTemplate; private final DiaryRecordWithProductRowMapper diaryRecordWithProductRowMapper; diff --git a/src/main/java/flab/nutridiary/diary/service/DiaryRetrievalService.java b/src/main/java/flab/nutridiary/diary/service/DiarySearchService.java similarity index 63% rename from src/main/java/flab/nutridiary/diary/service/DiaryRetrievalService.java rename to src/main/java/flab/nutridiary/diary/service/DiarySearchService.java index 733ebfd..06633f9 100644 --- a/src/main/java/flab/nutridiary/diary/service/DiaryRetrievalService.java +++ b/src/main/java/flab/nutridiary/diary/service/DiarySearchService.java @@ -1,7 +1,7 @@ package flab.nutridiary.diary.service; import flab.nutridiary.diary.dto.response.query.DiaryRecordWithProduct; -import flab.nutridiary.diary.repository.DiaryRetrievalRepository; +import flab.nutridiary.diary.repository.DiarySearchRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -12,11 +12,11 @@ @Transactional @Service @RequiredArgsConstructor -public class DiaryRetrievalService { - private final DiaryRetrievalRepository diaryRetrievalRepository; +public class DiarySearchService { + private final DiarySearchRepository diarySearchRepository; @Transactional(readOnly = true) public List getDiary(Long memberId, LocalDate diaryDate) { - return diaryRetrievalRepository.findDiaryWithProductAllByMemberIdAndDiaryDate(memberId, diaryDate); + return diarySearchRepository.findDiaryWithProductAllByMemberIdAndDiaryDate(memberId, diaryDate); } } diff --git a/src/test/java/flab/nutridiary/diary/repository/DiaryRetrievalRepositoryTest.java b/src/test/java/flab/nutridiary/diary/repository/DiarySearchRepositoryTest.java similarity index 95% rename from src/test/java/flab/nutridiary/diary/repository/DiaryRetrievalRepositoryTest.java rename to src/test/java/flab/nutridiary/diary/repository/DiarySearchRepositoryTest.java index c44bf17..641d0ef 100644 --- a/src/test/java/flab/nutridiary/diary/repository/DiaryRetrievalRepositoryTest.java +++ b/src/test/java/flab/nutridiary/diary/repository/DiarySearchRepositoryTest.java @@ -26,11 +26,11 @@ @ActiveProfiles("test") @Transactional @SpringBootTest -class DiaryRetrievalRepositoryTest{ +class DiarySearchRepositoryTest { @Autowired private NutritionCalculator nutritionCalculator; @Autowired - private DiaryRetrievalRepository diaryRetrievalRepository; + private DiarySearchRepository diarySearchRepository; @Autowired private DiaryRepository diaryRepository; @Autowired @@ -101,7 +101,7 @@ void findDiaryWithProductsByMemberIdAndDiaryDate() throws Exception { Long diaryId = diaryRepository.save(diary).getId(); // when - List results = diaryRetrievalRepository.findDiaryWithProductAllByMemberIdAndDiaryDate(memberId, LocalDate.of(2024, 8, 10)); + List results = diarySearchRepository.findDiaryWithProductAllByMemberIdAndDiaryDate(memberId, LocalDate.of(2024, 8, 10)); // then List expectedResults = List.of( diff --git a/src/test/java/flab/nutridiary/diary/service/DiaryRetrievalServiceTest.java b/src/test/java/flab/nutridiary/diary/service/DiarySearchServiceTest.java similarity index 96% rename from src/test/java/flab/nutridiary/diary/service/DiaryRetrievalServiceTest.java rename to src/test/java/flab/nutridiary/diary/service/DiarySearchServiceTest.java index bc27698..f74b0b8 100644 --- a/src/test/java/flab/nutridiary/diary/service/DiaryRetrievalServiceTest.java +++ b/src/test/java/flab/nutridiary/diary/service/DiarySearchServiceTest.java @@ -27,13 +27,13 @@ @ActiveProfiles("test") @Transactional @SpringBootTest -class DiaryRetrievalServiceTest { +class DiarySearchServiceTest { @Autowired private NutritionCalculator nutritionCalculator; @Autowired private DiaryRepository diaryRepository; @Autowired - private DiaryRetrievalService diaryRetrievalService; + private DiarySearchService diarySearchService; @Autowired private ProductRepository productRepository; private List savedProductIds = new ArrayList<>(); @@ -106,7 +106,7 @@ void getDiary() throws Exception { LocalDate date = LocalDate.of(2024, 8, 10); //when - List results = diaryRetrievalService.getDiary(memberId, date); + List results = diarySearchService.getDiary(memberId, date); // then List expectedResults = List.of(