Skip to content

Commit

Permalink
feat: 나눔 페이징 정렬 디폴트값적용, status 스트링으로 변경 (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiwon-cho authored Feb 22, 2024
1 parent cf5e4ba commit 72db573
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
12 changes: 7 additions & 5 deletions src/main/kotlin/mara/server/domain/share/Share.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion src/main/kotlin/mara/server/domain/share/ShareDto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/mara/server/domain/share/ShareRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 72db573

Please sign in to comment.