From 60c8941e61f023b34478f5e4fc31e85877fdfe34 Mon Sep 17 00:00:00 2001 From: Jo Seonggyu Date: Wed, 13 Mar 2024 02:17:08 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20researchEntity=EC=97=90=20websiteURL=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#211)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: researchEntity에 websiteURL 추가 * fix: ProfessorServiceTest 수정 --- .../csereal/core/research/database/ResearchEntity.kt | 5 ++++- .../core/research/database/ResearchSearchEntity.kt | 1 + .../csereal/core/research/dto/ResearchDto.kt | 2 ++ .../csereal/core/member/service/ProfessorServiceTest.kt | 2 ++ .../core/reseach/service/ResearchSearchServiceTest.kt | 3 ++- .../csereal/core/reseach/service/ResearchServiceTest.kt | 9 +++++++-- 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/research/database/ResearchEntity.kt b/src/main/kotlin/com/wafflestudio/csereal/core/research/database/ResearchEntity.kt index 33b1a55c..e0c3db51 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/research/database/ResearchEntity.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/research/database/ResearchEntity.kt @@ -22,6 +22,8 @@ class ResearchEntity( @Column(columnDefinition = "mediumText") var description: String?, + var websiteURL: String?, + @OneToMany(mappedBy = "research", cascade = [CascadeType.ALL], orphanRemoval = true) var labs: MutableList = mutableListOf(), @@ -43,7 +45,8 @@ class ResearchEntity( postType = researchDto.postType, language = languageType, name = researchDto.name, - description = researchDto.description + description = researchDto.description, + websiteURL = researchDto.websiteURL ) } } diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/research/database/ResearchSearchEntity.kt b/src/main/kotlin/com/wafflestudio/csereal/core/research/database/ResearchSearchEntity.kt index d07c5ae7..fce8d297 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/research/database/ResearchSearchEntity.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/research/database/ResearchSearchEntity.kt @@ -58,6 +58,7 @@ class ResearchSearchEntity( appendLine(cleanTextFromHtml(it)) } research.labs.forEach { appendLine(it.name) } + research.websiteURL?.let { appendLine(it) } }.toString() fun createContent(lab: LabEntity) = StringBuilder().apply { diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/research/dto/ResearchDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/research/dto/ResearchDto.kt index 11325c04..e87c6668 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/research/dto/ResearchDto.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/research/dto/ResearchDto.kt @@ -12,6 +12,7 @@ data class ResearchDto( val language: String, val name: String, val description: String?, + val websiteURL: String?, val createdAt: LocalDateTime?, val modifiedAt: LocalDateTime?, val labs: List?, @@ -26,6 +27,7 @@ data class ResearchDto( language = LanguageType.makeLowercase(entity.language), name = this.name, description = this.description, + websiteURL = this.websiteURL, createdAt = this.createdAt, modifiedAt = this.modifiedAt, labs = this.labs.map { ResearchLabResponse(id = it.id, name = it.name) }, diff --git a/src/test/kotlin/com/wafflestudio/csereal/core/member/service/ProfessorServiceTest.kt b/src/test/kotlin/com/wafflestudio/csereal/core/member/service/ProfessorServiceTest.kt index 6e38fa5e..9c6b282b 100644 --- a/src/test/kotlin/com/wafflestudio/csereal/core/member/service/ProfessorServiceTest.kt +++ b/src/test/kotlin/com/wafflestudio/csereal/core/member/service/ProfessorServiceTest.kt @@ -41,6 +41,7 @@ class ProfessorServiceTest( language = LanguageType.KO, name = "researchName", description = null, + websiteURL = null, postType = ResearchPostType.LABS ) var labEntity = LabEntity( @@ -143,6 +144,7 @@ class ProfessorServiceTest( language = LanguageType.KO, name = "researchName", description = null, + websiteURL = null, postType = ResearchPostType.LABS ) val labEntity1 = LabEntity( diff --git a/src/test/kotlin/com/wafflestudio/csereal/core/reseach/service/ResearchSearchServiceTest.kt b/src/test/kotlin/com/wafflestudio/csereal/core/reseach/service/ResearchSearchServiceTest.kt index 76603b52..85d9be47 100644 --- a/src/test/kotlin/com/wafflestudio/csereal/core/reseach/service/ResearchSearchServiceTest.kt +++ b/src/test/kotlin/com/wafflestudio/csereal/core/reseach/service/ResearchSearchServiceTest.kt @@ -98,7 +98,8 @@ class ResearchSearchServiceTest( language = LanguageType.KO, name = "research", postType = ResearchPostType.GROUPS, - description = null + description = null, + websiteURL = null ) ) diff --git a/src/test/kotlin/com/wafflestudio/csereal/core/reseach/service/ResearchServiceTest.kt b/src/test/kotlin/com/wafflestudio/csereal/core/reseach/service/ResearchServiceTest.kt index c7e8e91d..cf631d44 100644 --- a/src/test/kotlin/com/wafflestudio/csereal/core/reseach/service/ResearchServiceTest.kt +++ b/src/test/kotlin/com/wafflestudio/csereal/core/reseach/service/ResearchServiceTest.kt @@ -50,6 +50,7 @@ class ResearchServiceTest( name = "name", postType = ResearchPostType.CENTERS, description = "description", + websiteURL = null, createdAt = null, modifiedAt = null, labs = null, @@ -101,6 +102,7 @@ class ResearchServiceTest( name = "name", postType = ResearchPostType.CENTERS, description = "description", + websiteURL = null, createdAt = null, modifiedAt = null, labs = null, @@ -121,6 +123,7 @@ class ResearchServiceTest( name = "name2", postType = ResearchPostType.GROUPS, description = "description2", + websiteURL = null, createdAt = null, modifiedAt = null, labs = null, @@ -198,7 +201,8 @@ class ResearchServiceTest( language = LanguageType.KO, name = "research", postType = ResearchPostType.GROUPS, - description = null + description = null, + websiteURL = null ) ) @@ -305,7 +309,8 @@ class ResearchServiceTest( language = LanguageType.KO, name = "research", postType = ResearchPostType.GROUPS, - description = null + description = null, + websiteURL = null ) )