From 17ec6359dd3ddc64feabfa181b3b9244dc55559e Mon Sep 17 00:00:00 2001 From: rlaisqls Date: Fri, 27 Oct 2023 21:18:04 +0900 Subject: [PATCH] fix: createdAt --- .../persistence/dto/QuestionDetailDto.kt | 4 +++- .../question/persistence/dto/QuestionDto.kt | 4 +++- .../repository/QuestionsRepository.kt | 16 ++++++++++++++-- .../question/presentation/dto/Responses.kt | 15 ++++++++++----- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/dto/QuestionDetailDto.kt b/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/dto/QuestionDetailDto.kt index a7a5f84..811db02 100644 --- a/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/dto/QuestionDetailDto.kt +++ b/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/dto/QuestionDetailDto.kt @@ -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 @@ -13,5 +14,6 @@ class QuestionDetailDto @QueryProjection constructor( val question: String, val category: Category, val tagList: List, - val isFavorite: Boolean + val isFavorite: Boolean, + val createdAt: LocalDateTime ) \ No newline at end of file diff --git a/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/dto/QuestionDto.kt b/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/dto/QuestionDto.kt index ef60ff4..edd228a 100644 --- a/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/dto/QuestionDto.kt +++ b/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/dto/QuestionDto.kt @@ -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 @@ -13,7 +14,8 @@ class QuestionDto @QueryProjection constructor( val jobDuration: Int, tagList: List?, val isAnswered: Boolean, - val isFavorite: Boolean + val isFavorite: Boolean, + val createdAt: LocalDateTime ) { val tagList = tagList ?: listOf() } \ No newline at end of file diff --git a/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/QuestionsRepository.kt b/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/QuestionsRepository.kt index cc1978d..379ca40 100644 --- a/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/QuestionsRepository.kt +++ b/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/QuestionsRepository.kt @@ -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?, +// val isAnswered: Boolean, +// val isFavorite: Boolean } override fun queryQuestionDetailDtoById( @@ -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 ) ) ) diff --git a/src/main/kotlin/kr/hs/dsm/inq/domain/question/presentation/dto/Responses.kt b/src/main/kotlin/kr/hs/dsm/inq/domain/question/presentation/dto/Responses.kt index a415ff5..7e84786 100644 --- a/src/main/kotlin/kr/hs/dsm/inq/domain/question/presentation/dto/Responses.kt +++ b/src/main/kotlin/kr/hs/dsm/inq/domain/question/presentation/dto/Responses.kt @@ -54,7 +54,8 @@ data class QuestionResponse( val category: Category, val tags: List, val isAnswered: Boolean, - val isFavorite: Boolean + val isFavorite: Boolean, + val createdAt: LocalDateTime ) { companion object { fun of(dto: QuestionDto) = dto.run { @@ -67,7 +68,8 @@ data class QuestionResponse( jobDuration = jobDuration, tags = tagList.map { it.tag }, isAnswered = isAnswered, - isFavorite = isFavorite + isFavorite = isFavorite, + createdAt = createdAt ) } @@ -82,7 +84,8 @@ data class QuestionResponse( jobDuration = jobDuration, tags = tagList.map { it.tag }, isAnswered = isAnswered, - isFavorite = isFavorite + isFavorite = isFavorite, + createdAt = createdAt ) } } @@ -98,7 +101,8 @@ data class QuestionDetailResponse( val category: Category, val tags: List, val isFavorite: Boolean, - val exemplaryAnswer: AnswerResponse + val exemplaryAnswer: AnswerResponse, + val createdAt: LocalDateTime ) { companion object { fun of(questionDetail: QuestionDetailDto, answer: AnswersDto) = questionDetail.run { @@ -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 ) } }