From 72db573327032dd7547fbc58c3c55d12c236508c Mon Sep 17 00:00:00 2001 From: Cho jiwon <77895305+Jiwon-cho@users.noreply.github.com> Date: Thu, 22 Feb 2024 21:01:12 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=82=98=EB=88=94=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=95=20=EC=A0=95=EB=A0=AC=20=EB=94=94=ED=8F=B4=ED=8A=B8?= =?UTF-8?q?=EA=B0=92=EC=A0=81=EC=9A=A9,=20status=20=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EB=A7=81=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#38)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/mara/server/domain/share/Share.kt | 12 +++++++----- src/main/kotlin/mara/server/domain/share/ShareDto.kt | 2 +- .../mara/server/domain/share/ShareRepository.kt | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/mara/server/domain/share/Share.kt b/src/main/kotlin/mara/server/domain/share/Share.kt index f64dddc..88f61fb 100644 --- a/src/main/kotlin/mara/server/domain/share/Share.kt +++ b/src/main/kotlin/mara/server/domain/share/Share.kt @@ -1,8 +1,9 @@ package mara.server.domain.share -import com.fasterxml.jackson.annotation.JsonValue import jakarta.persistence.CascadeType import jakarta.persistence.Entity +import jakarta.persistence.EnumType +import jakarta.persistence.Enumerated import jakarta.persistence.FetchType import jakarta.persistence.GeneratedValue import jakarta.persistence.GenerationType @@ -33,6 +34,7 @@ data class Share( var shareDatetime: LocalDateTime, var limitPerson: Int, var location: String, + @Enumerated(EnumType.STRING) var status: ShareStatus, var thumbNailImage: String ) : BaseEntity() { @@ -76,8 +78,8 @@ data class Share( } } -enum class ShareStatus(@JsonValue val statusValue: String) { - SHARE_START("start"), - SHARE_IN_PROGRESS("in_progress"), - SHARE_COMPLETE("complete") +enum class ShareStatus() { + SHARE_START, + SHARE_IN_PROGRESS, + SHARE_COMPLETE } diff --git a/src/main/kotlin/mara/server/domain/share/ShareDto.kt b/src/main/kotlin/mara/server/domain/share/ShareDto.kt index bcb9f42..3be9913 100644 --- a/src/main/kotlin/mara/server/domain/share/ShareDto.kt +++ b/src/main/kotlin/mara/server/domain/share/ShareDto.kt @@ -59,7 +59,7 @@ data class ShareResponse( limitDate = share.ingredientDetail.expirationDate.toLocalDate(), limitPerson = share.limitPerson, location = share.location, - status = share.status.statusValue, + status = share.status.name, thumbNailImage = share.thumbNailImage, ) } diff --git a/src/main/kotlin/mara/server/domain/share/ShareRepository.kt b/src/main/kotlin/mara/server/domain/share/ShareRepository.kt index 62a17d7..a9a9f48 100644 --- a/src/main/kotlin/mara/server/domain/share/ShareRepository.kt +++ b/src/main/kotlin/mara/server/domain/share/ShareRepository.kt @@ -35,9 +35,9 @@ class CustomShareRepositoryImpl( .from(friendship) .where(friendship.fromUser.eq(user)) - var sortBy = "" + var sortBy = registeredDate pageable.sort.forEach { order -> - sortBy = order.property + if (order.property == dueDate) sortBy = dueDate } val query = queryFactory.selectFrom(share)