Skip to content

Commit

Permalink
fix: createdAt
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaisqls committed Oct 27, 2023
1 parent 3b8bbd5 commit 17ec635
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package kr.hs.dsm.inq.domain.question.persistence.dto

import com.querydsl.core.annotations.QueryProjection
import java.time.LocalDateTime
import kr.hs.dsm.inq.domain.question.persistence.Category
import kr.hs.dsm.inq.domain.question.persistence.Tags

Expand All @@ -13,5 +14,6 @@ class QuestionDetailDto @QueryProjection constructor(
val question: String,
val category: Category,
val tagList: List<Tags>,
val isFavorite: Boolean
val isFavorite: Boolean,
val createdAt: LocalDateTime
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package kr.hs.dsm.inq.domain.question.persistence.dto

import com.querydsl.core.annotations.QueryProjection
import java.time.LocalDateTime
import kr.hs.dsm.inq.domain.question.persistence.Category
import kr.hs.dsm.inq.domain.question.persistence.Tags

Expand All @@ -13,7 +14,8 @@ class QuestionDto @QueryProjection constructor(
val jobDuration: Int,
tagList: List<Tags>?,
val isAnswered: Boolean,
val isFavorite: Boolean
val isFavorite: Boolean,
val createdAt: LocalDateTime
) {
val tagList = tagList ?: listOf()
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,21 @@ class CustomQuestionRepositoryImpl(
/* jobDuration = */ writer.jobDuration,
/* tagList = */ GroupBy.list(tags),
/* isAnswered = */ questions.isNull, // answers.isNotNull,
/* isFavorite = */ questions.isNull // favorite.isNotNull
/* isFavorite = */ questions.isNull, // favorite.isNotNull
/* createdAt = */ questions.createdAt
)
)
)

// val questionId: Long,
// val question: String,
// val category: Category,
// val username: String,
// val job: String,
// val jobDuration: Int,
// tagList: List<Tags>?,
// val isAnswered: Boolean,
// val isFavorite: Boolean
}

override fun queryQuestionDetailDtoById(
Expand Down Expand Up @@ -142,7 +153,8 @@ class CustomQuestionRepositoryImpl(
/* question = */ questions.question,
/* category = */ questions.category,
/* tagList = */ GroupBy.list(tags),
/* isFavorite = */ questions.isNull
/* isFavorite = */ questions.isNull,
/* createdAt = */ questions.createdAt
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ data class QuestionResponse(
val category: Category,
val tags: List<String>,
val isAnswered: Boolean,
val isFavorite: Boolean
val isFavorite: Boolean,
val createdAt: LocalDateTime
) {
companion object {
fun of(dto: QuestionDto) = dto.run {
Expand All @@ -67,7 +68,8 @@ data class QuestionResponse(
jobDuration = jobDuration,
tags = tagList.map { it.tag },
isAnswered = isAnswered,
isFavorite = isFavorite
isFavorite = isFavorite,
createdAt = createdAt
)
}

Expand All @@ -82,7 +84,8 @@ data class QuestionResponse(
jobDuration = jobDuration,
tags = tagList.map { it.tag },
isAnswered = isAnswered,
isFavorite = isFavorite
isFavorite = isFavorite,
createdAt = createdAt
)
}
}
Expand All @@ -98,7 +101,8 @@ data class QuestionDetailResponse(
val category: Category,
val tags: List<String>,
val isFavorite: Boolean,
val exemplaryAnswer: AnswerResponse
val exemplaryAnswer: AnswerResponse,
val createdAt: LocalDateTime
) {
companion object {
fun of(questionDetail: QuestionDetailDto, answer: AnswersDto) = questionDetail.run {
Expand All @@ -112,7 +116,8 @@ data class QuestionDetailResponse(
category = category,
tags = tagList.map { it.tag },
isFavorite = isFavorite,
exemplaryAnswer = AnswerResponse.of(answer)
exemplaryAnswer = AnswerResponse.of(answer),
createdAt = createdAt
)
}
}
Expand Down

0 comments on commit 17ec635

Please sign in to comment.