Skip to content

Commit

Permalink
chore: dDay -> dday로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Kim0914 committed Aug 2, 2023
1 parent bec77a0 commit aa3abac
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public Long calculateDaySince(LocalDate currentDate) {
/**
* - 0 : 오늘 할 일 - 음수 : 할 일 - 양수 : 지각
*/
public Long calculateDDay(LocalDate currentDate) {
public Long calculateDday(LocalDate currentDate) {
return ChronoUnit.DAYS.between(nextWaterDate, currentDate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static PetPlant toPetPlant(PetPlantCreateRequest request, DictionaryPlant
.build();
}

public static PetPlantResponse toPetPlantResponse(PetPlant petPlant, Long dDay, Long daySince) {
public static PetPlantResponse toPetPlantResponse(PetPlant petPlant, Long dday, Long daySince) {
return PetPlantResponse.builder()
.id(petPlant.getId())
.nickname(petPlant.getNickname())
Expand All @@ -45,7 +45,7 @@ public static PetPlantResponse toPetPlantResponse(PetPlant petPlant, Long dDay,
.birthDate(petPlant.getBirthDate())
.lastWaterDate(petPlant.getLastWaterDate())
.waterCycle(petPlant.getWaterCycle())
.dDay(dDay)
.dday(dday)
.nextWaterDate(petPlant.getNextWaterDate())
.daySince(daySince)
.build();
Expand All @@ -62,13 +62,13 @@ public static SinglePetPlantResponse toSinglePetPlantResponse(PetPlant petPlant,
.build();
}

public static ReminderResponse toReminderResponse(PetPlant petPlant, Long dDay) {
public static ReminderResponse toReminderResponse(PetPlant petPlant, Long dday) {
return ReminderResponse.builder()
.petPlantId(petPlant.getId())
.image(petPlant.getImageUrl())
.nickName(petPlant.getNickname())
.dictionaryPlantName(petPlant.getDictionaryPlant().getName())
.dDay(dDay)
.dday(dday)
.nextWaterDate(petPlant.getNextWaterDate())
.lastWaterDate(petPlant.getLastWaterDate())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public PetPlantResponse create(PetPlantCreateRequest request, Member member) {
petPlantRepository.save(petPlant);

long daySince = petPlant.calculateDaySince(LocalDate.now());
long dDay = petPlant.calculateDDay(LocalDate.now());
long dday = petPlant.calculateDday(LocalDate.now());

return PetPlantMapper.toPetPlantResponse(petPlant, dDay, daySince);
return PetPlantMapper.toPetPlantResponse(petPlant, dday, daySince);
}

public PetPlantResponse read(Long id, Member member) {
Expand All @@ -47,7 +47,7 @@ public PetPlantResponse read(Long id, Member member) {

checkOwner(petPlant, member);

Long dday = petPlant.calculateDDay(LocalDate.now());
Long dday = petPlant.calculateDday(LocalDate.now());
Long daySince = petPlant.calculateDaySince(LocalDate.now());

return PetPlantMapper.toPetPlantResponse(petPlant, dday, daySince);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public DataResponse<List<ReminderResponse>> readAll(Member member) {
List<ReminderResponse> reminderResponses = petPlants.stream()
.map(petPlant -> PetPlantMapper.toReminderResponse(
petPlant,
petPlant.calculateDDay(LocalDate.now())))
petPlant.calculateDday(LocalDate.now())))
.toList();

return DataResponse.<List<ReminderResponse>>builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class PetPlantResponse {
private String wind;
private Integer waterCycle;
private Long daySince;
private Long dDay;
private Long dday;

@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate birthDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class ReminderResponse {
private String image;
private String nickName;
private String dictionaryPlantName;
private Long dDay;
private Long dday;

@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate nextWaterDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class PetPlantTest {
.nextWaterDate(LocalDate.of(2022, 7, 8))
.build();

Long result = 산세베리아.calculateDDay(LocalDate.of(year, month, day));
Long result = 산세베리아.calculateDday(LocalDate.of(year, month, day));

assertThat(result).isEqualTo(dDay);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static class RESPONSE {
.birthDate(LocalDate.now())
.lastWaterDate(LocalDate.now())
.waterCycle(3)
.dDay(1L)
.dday(1L)
.daySince(1L)
.dictionaryPlant(DictionaryPlantResponse.builder()
.id(1L)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static class RESPONSE {
.dictionaryPlantName("라벤더")
.image("image.com")
.nextWaterDate(LocalDate.now())
.dDay(0L)
.dday(0L)
.build()
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void setUp() {
DataResponse<List<ReminderResponse>> actual = reminderService.readAll(petPlant.getMember());

List<ReminderResponse> expected = List.of(
PetPlantMapper.toReminderResponse(petPlant, petPlant.calculateDDay(LocalDate.now())));
PetPlantMapper.toReminderResponse(petPlant, petPlant.calculateDday(LocalDate.now())));

assertThat(actual.getData())
.hasSize(1)
Expand Down

0 comments on commit aa3abac

Please sign in to comment.