diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/seminar/database/SeminarEntity.kt b/src/main/kotlin/com/wafflestudio/csereal/core/seminar/database/SeminarEntity.kt index d5d63b6b..264c13d6 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/seminar/database/SeminarEntity.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/seminar/database/SeminarEntity.kt @@ -8,6 +8,7 @@ import com.wafflestudio.csereal.core.resource.attachment.database.AttachmentEnti import com.wafflestudio.csereal.core.resource.mainImage.database.MainImageEntity import com.wafflestudio.csereal.core.seminar.dto.SeminarDto import jakarta.persistence.* +import java.time.LocalDateTime @Entity(name = "seminar") class SeminarEntity( @@ -35,8 +36,8 @@ class SeminarEntity( var affiliation: String, var affiliationURL: String?, - var startDate: String?, - var endDate: String?, + var startDate: LocalDateTime?, + var endDate: LocalDateTime?, var location: String, diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/seminar/database/SeminarRepository.kt b/src/main/kotlin/com/wafflestudio/csereal/core/seminar/database/SeminarRepository.kt index 46bb4981..4043fd4b 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/seminar/database/SeminarRepository.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/seminar/database/SeminarRepository.kt @@ -4,7 +4,6 @@ import com.querydsl.core.BooleanBuilder import com.querydsl.jpa.impl.JPAQueryFactory import com.wafflestudio.csereal.common.CserealException import com.wafflestudio.csereal.common.utils.FixedPageRequest -import com.wafflestudio.csereal.common.utils.cleanTextFromHtml import com.wafflestudio.csereal.core.resource.mainImage.service.MainImageService import com.wafflestudio.csereal.core.seminar.database.QSeminarEntity.seminarEntity import com.wafflestudio.csereal.core.seminar.dto.SeminarSearchDto @@ -75,11 +74,7 @@ class SeminarRepositoryImpl( var isYearLast = false if (i == seminarEntityList.size - 1) { isYearLast = true - } else if (seminarEntityList[i].startDate?.substring(0, 4) != seminarEntityList[i + 1].startDate?.substring( - 0, - 4 - ) - ) { + } else if (seminarEntityList[i].startDate?.year != seminarEntityList[i + 1].startDate?.year) { isYearLast = true } @@ -100,6 +95,6 @@ class SeminarRepositoryImpl( ) } - return SeminarSearchResponse(total!!, seminarSearchDtoList) + return SeminarSearchResponse(total, seminarSearchDtoList) } } diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/seminar/dto/SeminarDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/seminar/dto/SeminarDto.kt index 91c58b78..2855ec2a 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/seminar/dto/SeminarDto.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/seminar/dto/SeminarDto.kt @@ -15,8 +15,8 @@ data class SeminarDto( val speakerTitle: String?, val affiliation: String, val affiliationURL: String?, - val startDate: String?, - val endDate: String?, + val startDate: LocalDateTime?, + val endDate: LocalDateTime?, val location: String, val host: String?, val additionalNote: String?, diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/seminar/dto/SeminarSearchDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/seminar/dto/SeminarSearchDto.kt index 483f8513..6bd7c055 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/seminar/dto/SeminarSearchDto.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/seminar/dto/SeminarSearchDto.kt @@ -1,6 +1,7 @@ package com.wafflestudio.csereal.core.seminar.dto import com.querydsl.core.annotations.QueryProjection +import java.time.LocalDateTime data class SeminarSearchDto @QueryProjection constructor( val id: Long, @@ -8,9 +9,9 @@ data class SeminarSearchDto @QueryProjection constructor( val description: String, val name: String, val affiliation: String, - val startDate: String?, + val startDate: LocalDateTime?, val location: String, val imageURL: String?, val isYearLast: Boolean, ) { -} \ No newline at end of file +} diff --git a/src/test/kotlin/com/wafflestudio/csereal/core/seminar/service/SeminarServiceTest.kt b/src/test/kotlin/com/wafflestudio/csereal/core/seminar/service/SeminarServiceTest.kt index 0ff9573a..64359c52 100644 --- a/src/test/kotlin/com/wafflestudio/csereal/core/seminar/service/SeminarServiceTest.kt +++ b/src/test/kotlin/com/wafflestudio/csereal/core/seminar/service/SeminarServiceTest.kt @@ -9,13 +9,14 @@ import io.kotest.matchers.shouldNotBe import jakarta.transaction.Transactional import org.springframework.boot.test.context.SpringBootTest import org.springframework.data.repository.findByIdOrNull +import java.time.LocalDateTime @SpringBootTest @Transactional -class SeminarServiceTest ( +class SeminarServiceTest( private val seminarService: SeminarService, private val seminarRepository: SeminarRepository, -): BehaviorSpec() { +) : BehaviorSpec() { init { beforeContainer { @@ -27,42 +28,42 @@ class SeminarServiceTest ( Given("세미나를 생성하려고 할 때") { val seminarDTO = SeminarDto( - id = -1, - title = "title", - description = """ + id = -1, + title = "title", + description = """
This is seminar description.
This is seminar introduction.
This is seminar additionalNote.
This is seminar description.
This is seminar introduction.
This is seminar additionalNote.
This is modified seminar description.
And this is a new line.
""".trimIndent(), - introduction = """ + introduction = """This is modified seminar introduction.
And this is a new line.
""".trimIndent(), - additionalNote = """ + additionalNote = """This is modified seminar additionalNote.