Skip to content

Commit

Permalink
Merge pull request #86 from dnd-side-project/feat/myplant-detail
Browse files Browse the repository at this point in the history
[BLOOM-085] 내 식물 상세조회 LocalDate 응답필드 추가
  • Loading branch information
Dompoo authored Aug 23, 2024
2 parents a27ae2f + bb39cfc commit 0be14de
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ data class MyPlantDetailResponse(
val lastWateredTitle: String,
@field:Schema(description = "마지막으로 물 준 날짜 컴포넌트 내용", example = "2024-05-17\n17일전")
val lastWateredInfo: String,
@field:Schema(description = "마지막으로 물 준 날짜", example = "2024-05-17")
val lastWateredDate: LocalDate?,
@field:Schema(description = "마지막으로 비료 준 날짜 컴포넌트 제목", example = "비료주기")
val lastFertilizerTitle: String,
@field:Schema(description = "마지막으로 준 날짜 컴포넌트 내용", example = "17일전")
@field:Schema(description = "마지막으로 비료 준 날짜 컴포넌트 내용", example = "17일전")
val lastFertilizerInfo: String,
@field:Schema(description = "마지막으로 비료 준 날짜", example = "2024-05-17")
val lastFertilizerDate: LocalDate?,
@field:Schema(description = "물주기 알림 여부", example = "true")
val waterAlarm: Boolean,
@field:Schema(description = "물주기 알림 주기", example = "4")
Expand Down Expand Up @@ -59,8 +63,10 @@ data class MyPlantDetailResponse(
withDays = Period.between(myPlant.startDate, now).days,
lastWateredTitle = messageFactory.createWateredTitle(),
lastWateredInfo = messageFactory.createWateredInfo(myPlant.lastWateredDate, now),
lastWateredDate = myPlant.lastWateredDate,
lastFertilizerTitle = messageFactory.createFertilizerTitle(),
lastFertilizerInfo = messageFactory.createFertilizerInfo(myPlant.lastFertilizerDate, now),
lastFertilizerDate = myPlant.lastFertilizerDate,
waterAlarm = myPlant.alarm.waterAlarm,
waterPeriod = myPlant.alarm.waterPeriod,
fertilizerAlarm = myPlant.alarm.fertilizerAlarm,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class MyPlantControllerTest : WebMvcDescribeSpec() {
nickname = NICKNAME,
locationId = LOCATION_ID,
startDate = START_DATE,
lastWateredDate = LAST_WATERED_DATE,
lastFertilizerDate = LAST_FERTILIZER_DATE,
lastWateredDate = LAST_WATERED_DATE_INT,
lastFertilizerDate = LAST_FERTILIZER_DATE_INT,
waterAlarm = WATER_ALARM,
waterPeriod = WATER_PERIOD,
fertilizerAlarm = FERTILIZER_ALARM,
Expand Down Expand Up @@ -155,8 +155,10 @@ class MyPlantControllerTest : WebMvcDescribeSpec() {
withDays = WITH_DAYS,
lastWateredTitle = LAST_WATERED_TITLE,
lastWateredInfo = LAST_WATERED_INFO,
lastWateredDate = LAST_WATERED_DATE,
lastFertilizerTitle = LAST_FERTILIZER_TITLE,
lastFertilizerInfo = LAST_FERTILIZER_INFO,
lastFertilizerDate = LAST_FERTILIZER_DATE,
waterAlarm = WATER_ALARM,
waterPeriod = WATER_PERIOD,
fertilizerAlarm = FERTILIZER_ALARM,
Expand Down Expand Up @@ -243,8 +245,8 @@ class MyPlantControllerTest : WebMvcDescribeSpec() {
nickname = NICKNAME,
locationId = LOCATION_ID,
startDate = START_DATE,
lastWateredDate = LAST_WATERED_DATE,
lastFertilizerDate = LAST_FERTILIZER_DATE,
lastWateredDate = LAST_WATERED_DATE_INT,
lastFertilizerDate = LAST_FERTILIZER_DATE_INT,
),
)
it("정상 흐름이 반환되어야 한다.") {
Expand All @@ -263,8 +265,8 @@ class MyPlantControllerTest : WebMvcDescribeSpec() {
nickname = NICKNAME,
locationId = LOCATION_ID,
startDate = START_DATE,
lastWateredDate = LAST_WATERED_DATE,
lastFertilizerDate = LAST_FERTILIZER_DATE,
lastWateredDate = LAST_WATERED_DATE_INT,
lastFertilizerDate = LAST_FERTILIZER_DATE_INT,
),
)
it("예외응답이 반환되어야 한다.") {
Expand All @@ -285,8 +287,8 @@ class MyPlantControllerTest : WebMvcDescribeSpec() {
nickname = NICKNAME,
locationId = LOCATION_ID + 1,
startDate = START_DATE,
lastWateredDate = LAST_WATERED_DATE,
lastFertilizerDate = LAST_FERTILIZER_DATE,
lastWateredDate = LAST_WATERED_DATE_INT,
lastFertilizerDate = LAST_FERTILIZER_DATE_INT,
),
)
it("예외응답이 반환되어야 한다.") {
Expand Down Expand Up @@ -440,8 +442,10 @@ class MyPlantControllerTest : WebMvcDescribeSpec() {
const val LOCATION_NAME = "거실"
val START_DATE: LocalDate = LocalDate.of(2024, 4, 19)
const val WITH_DAYS = 234
const val LAST_WATERED_DATE = 1
const val LAST_FERTILIZER_DATE = 2
const val LAST_WATERED_DATE_INT = 1
val LAST_WATERED_DATE: LocalDate = CURRENT_DAY.minusDays(LAST_WATERED_DATE_INT.toLong())
const val LAST_FERTILIZER_DATE_INT = 2
val LAST_FERTILIZER_DATE: LocalDate = CURRENT_DAY.minusDays(LAST_FERTILIZER_DATE_INT.toLong())
val LAST_HEALTHCHECK_DATE: LocalDate = LocalDate.of(2024, 6, 15)
const val DATE_SINCE_LAST_WATER = 3
const val DATE_SINCE_LAST_FERTILIZER = 3
Expand All @@ -460,6 +464,6 @@ class MyPlantControllerTest : WebMvcDescribeSpec() {
val LAST_FERTILIZER_TITLE = "비료주기"
val LAST_FERTILIZER_INFO = "이번 달"
val LAST_WATERED_TITLE = "마지막으로 물 준 날"
val LAST_WATERED_INFO = "${LAST_WATERED_DATE}\n1일전"
val LAST_WATERED_INFO = "${LAST_WATERED_DATE_INT}\n1일전"
}
}

0 comments on commit 0be14de

Please sign in to comment.