From c327284a8767a62652420c9a363461c1ee012dfd Mon Sep 17 00:00:00 2001 From: "DESKTOP-USQPRVG\\gram" Date: Sat, 24 Feb 2024 23:29:58 +0900 Subject: [PATCH 1/7] =?UTF-8?q?fix:=20professor=20language=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../csereal/core/member/database/ProfessorEntity.kt | 6 +++++- .../wafflestudio/csereal/core/member/dto/ProfessorDto.kt | 3 +++ .../csereal/core/member/service/ProfessorService.kt | 7 +++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/member/database/ProfessorEntity.kt b/src/main/kotlin/com/wafflestudio/csereal/core/member/database/ProfessorEntity.kt index b1c80c43..00b46019 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/member/database/ProfessorEntity.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/member/database/ProfessorEntity.kt @@ -2,6 +2,7 @@ package com.wafflestudio.csereal.core.member.database import com.wafflestudio.csereal.common.config.BaseTimeEntity import com.wafflestudio.csereal.common.controller.MainImageContentEntityType +import com.wafflestudio.csereal.common.properties.LanguageType import com.wafflestudio.csereal.core.member.dto.ProfessorDto import com.wafflestudio.csereal.core.research.database.LabEntity import com.wafflestudio.csereal.core.resource.mainImage.database.MainImageEntity @@ -10,6 +11,8 @@ import java.time.LocalDate @Entity(name = "professor") class ProfessorEntity( + @Enumerated(EnumType.STRING) + var language: LanguageType, var name: String, @@ -49,8 +52,9 @@ class ProfessorEntity( override fun bringMainImage(): MainImageEntity? = mainImage companion object { - fun of(professorDto: ProfessorDto): ProfessorEntity { + fun of(languageType: LanguageType, professorDto: ProfessorDto): ProfessorEntity { return ProfessorEntity( + language = languageType, name = professorDto.name, status = professorDto.status, academicRank = professorDto.academicRank, diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/member/dto/ProfessorDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/member/dto/ProfessorDto.kt index 90bf7f47..072db7e1 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/member/dto/ProfessorDto.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/member/dto/ProfessorDto.kt @@ -1,6 +1,7 @@ package com.wafflestudio.csereal.core.member.dto import com.fasterxml.jackson.annotation.JsonInclude +import com.wafflestudio.csereal.common.properties.LanguageType import com.wafflestudio.csereal.core.member.database.ProfessorEntity import com.wafflestudio.csereal.core.member.database.ProfessorStatus import java.time.LocalDate @@ -8,6 +9,7 @@ import java.time.LocalDate data class ProfessorDto( @JsonInclude(JsonInclude.Include.NON_NULL) var id: Long? = null, + val language: String, val name: String, val status: ProfessorStatus, val academicRank: String, @@ -31,6 +33,7 @@ data class ProfessorDto( fun of(professorEntity: ProfessorEntity, imageURL: String?): ProfessorDto { return ProfessorDto( id = professorEntity.id, + language = LanguageType.makeLowercase(professorEntity.language), name = professorEntity.name, status = professorEntity.status, academicRank = professorEntity.academicRank, diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/member/service/ProfessorService.kt b/src/main/kotlin/com/wafflestudio/csereal/core/member/service/ProfessorService.kt index ebc22b35..a0eb66fa 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/member/service/ProfessorService.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/member/service/ProfessorService.kt @@ -1,6 +1,7 @@ package com.wafflestudio.csereal.core.member.service import com.wafflestudio.csereal.common.CserealException +import com.wafflestudio.csereal.common.properties.LanguageType import com.wafflestudio.csereal.core.member.database.* import com.wafflestudio.csereal.core.member.dto.ProfessorDto import com.wafflestudio.csereal.core.member.dto.ProfessorPageDto @@ -40,7 +41,8 @@ class ProfessorServiceImpl( private val applicationEventPublisher: ApplicationEventPublisher ) : ProfessorService { override fun createProfessor(createProfessorRequest: ProfessorDto, mainImage: MultipartFile?): ProfessorDto { - val professor = ProfessorEntity.of(createProfessorRequest) + val enumLanguageType = LanguageType.makeStringToLanguageType(createProfessorRequest.language) + val professor = ProfessorEntity.of(enumLanguageType, createProfessorRequest) if (createProfessorRequest.labId != null) { val lab = labRepository.findByIdOrNull(createProfessorRequest.labId) ?: throw CserealException.Csereal404("해당 연구실을 찾을 수 없습니다. LabId: ${createProfessorRequest.labId}") @@ -199,7 +201,8 @@ class ProfessorServiceImpl( val list = mutableListOf() for (request in requestList) { - val professor = ProfessorEntity.of(request) + val enumLanguageType = LanguageType.makeStringToLanguageType(request.language) + val professor = ProfessorEntity.of(enumLanguageType, request) if (request.labName != null) { val lab = labRepository.findByName(request.labName) ?: throw CserealException.Csereal404("해당 연구실을 찾을 수 없습니다. LabName: ${request.labName}") From de390ac0f94847b178c464e950de6fd2161a81df Mon Sep 17 00:00:00 2001 From: "DESKTOP-USQPRVG\\gram" Date: Sun, 25 Feb 2024 00:18:40 +0900 Subject: [PATCH 2/7] =?UTF-8?q?feat:=20professor=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../csereal/core/member/service/ProfessorServiceTest.kt | 4 ++++ 1 file changed, 4 insertions(+) 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 b3a8b144..193bf92f 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 @@ -54,6 +54,7 @@ class ProfessorServiceTest( labEntity = labRepository.save(labEntity) val professorDto = ProfessorDto( + language = "ko", name = "name", email = "email", status = ProfessorStatus.ACTIVE, @@ -82,6 +83,7 @@ class ProfessorServiceTest( Then("교수의 정보가 일치해야 한다") { val professorEntity = professorRepository.findByIdOrNull(createdProfessorDto.id)!! + professorEntity.language shouldBe professorDto.language professorEntity.name shouldBe professorDto.name professorEntity.email shouldBe professorDto.email professorEntity.status shouldBe professorDto.status @@ -162,6 +164,7 @@ class ProfessorServiceTest( val createdProfessorDto = professorService.createProfessor( ProfessorDto( + language = "ko", name = "name", email = "email", status = ProfessorStatus.ACTIVE, @@ -210,6 +213,7 @@ class ProfessorServiceTest( val professorEntity = professorRepository.findByIdOrNull(modifiedProfessorDto.id) professorEntity shouldNotBe null + professorEntity!!.language shouldBe toModifyProfessorDto.language professorEntity!!.name shouldBe toModifyProfessorDto.name professorEntity.email shouldBe toModifyProfessorDto.email professorEntity.status shouldBe toModifyProfessorDto.status From 5e5f0cb263cadf8c022bde05c7e9c8e9728977a0 Mon Sep 17 00:00:00 2001 From: "DESKTOP-USQPRVG\\gram" Date: Sun, 25 Feb 2024 00:25:39 +0900 Subject: [PATCH 3/7] =?UTF-8?q?feat:=20professor=20language=20=EB=8B=A4?= =?UTF-8?q?=EB=A5=B8=20=ED=85=8C=EC=8A=A4=ED=8A=B8=EC=97=90=EB=8F=84=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/reseach/service/ResearchSearchServiceTest.kt | 3 +++ .../csereal/core/reseach/service/ResearchServiceTest.kt | 6 ++++++ 2 files changed, 9 insertions(+) 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 032743ba..031ec07a 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 @@ -47,6 +47,7 @@ class ResearchSearchServiceTest( // Save professors val professor1Dto = professorService.createProfessor( createProfessorRequest = ProfessorDto( + language = "ko", name = "professor1", email = null, status = ProfessorStatus.ACTIVE, @@ -67,6 +68,7 @@ class ResearchSearchServiceTest( ) val professor2Dto = professorService.createProfessor( createProfessorRequest = ProfessorDto( + language = "ko", name = "professor2", email = null, status = ProfessorStatus.ACTIVE, @@ -160,6 +162,7 @@ class ResearchSearchServiceTest( When("professor가 추가된다면") { val process3CreatedDto = professorService.createProfessor( createProfessorRequest = ProfessorDto( + language = "ko", name = "newProfessor", email = "email", status = ProfessorStatus.ACTIVE, 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 468372f1..df6eb464 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 @@ -1,5 +1,6 @@ package com.wafflestudio.csereal.core.reseach.service +import com.wafflestudio.csereal.common.properties.LanguageType import com.wafflestudio.csereal.core.member.database.ProfessorEntity import com.wafflestudio.csereal.core.member.database.ProfessorRepository import com.wafflestudio.csereal.core.member.database.ProfessorStatus @@ -156,6 +157,7 @@ class ResearchServiceTest( // Save professors val professor1 = professorRepository.save( ProfessorEntity( + language = LanguageType.KO, name = "professor1", status = ProfessorStatus.ACTIVE, academicRank = "professor", @@ -170,6 +172,7 @@ class ResearchServiceTest( ) val professor2 = professorRepository.save( ProfessorEntity( + language = LanguageType.KO, name = "professor2", status = ProfessorStatus.ACTIVE, academicRank = "professor", @@ -258,6 +261,7 @@ class ResearchServiceTest( // Save professors val professor1 = professorRepository.save( ProfessorEntity( + language = LanguageType.KO, name = "professor1", status = ProfessorStatus.ACTIVE, academicRank = "professor", @@ -272,6 +276,7 @@ class ResearchServiceTest( ) val professor2 = professorRepository.save( ProfessorEntity( + language = LanguageType.KO, name = "professor2", status = ProfessorStatus.ACTIVE, academicRank = "professor", @@ -318,6 +323,7 @@ class ResearchServiceTest( When("pdf를 제외하고 Lab을 수정한다면") { val professor3 = professorRepository.save( ProfessorEntity( + language = LanguageType.KO, name = "professor3", status = ProfessorStatus.ACTIVE, academicRank = "professor", From 3b0254af8599e51ff61a34c46ed0b8be4daf5d04 Mon Sep 17 00:00:00 2001 From: "DESKTOP-USQPRVG\\gram" Date: Sun, 25 Feb 2024 00:31:17 +0900 Subject: [PATCH 4/7] =?UTF-8?q?feat:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=95=8C=EB=A7=9E=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../csereal/core/member/service/ProfessorServiceTest.kt | 2 -- 1 file changed, 2 deletions(-) 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 193bf92f..bbb1e43c 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 @@ -83,7 +83,6 @@ class ProfessorServiceTest( Then("교수의 정보가 일치해야 한다") { val professorEntity = professorRepository.findByIdOrNull(createdProfessorDto.id)!! - professorEntity.language shouldBe professorDto.language professorEntity.name shouldBe professorDto.name professorEntity.email shouldBe professorDto.email professorEntity.status shouldBe professorDto.status @@ -213,7 +212,6 @@ class ProfessorServiceTest( val professorEntity = professorRepository.findByIdOrNull(modifiedProfessorDto.id) professorEntity shouldNotBe null - professorEntity!!.language shouldBe toModifyProfessorDto.language professorEntity!!.name shouldBe toModifyProfessorDto.name professorEntity.email shouldBe toModifyProfessorDto.email professorEntity.status shouldBe toModifyProfessorDto.status From 9ebf79d6c4e75e8c1ac48876f667794cc3f16dd8 Mon Sep 17 00:00:00 2001 From: "DESKTOP-USQPRVG\\gram" Date: Sun, 25 Feb 2024 14:00:56 +0900 Subject: [PATCH 5/7] =?UTF-8?q?feat:=20researchDetail=EC=97=90=20language?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../csereal/core/research/database/ResearchEntity.kt | 7 ++++++- .../wafflestudio/csereal/core/research/dto/ResearchDto.kt | 3 +++ .../csereal/core/research/service/ResearchService.kt | 7 +++++-- .../csereal/core/member/service/ProfessorServiceTest.kt | 3 +++ .../csereal/core/reseach/service/ResearchServiceTest.kt | 5 +++++ 5 files changed, 22 insertions(+), 3 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 20997609..33b1a55c 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 @@ -3,6 +3,7 @@ package com.wafflestudio.csereal.core.research.database import com.wafflestudio.csereal.common.config.BaseTimeEntity import com.wafflestudio.csereal.common.controller.AttachmentContentEntityType import com.wafflestudio.csereal.common.controller.MainImageContentEntityType +import com.wafflestudio.csereal.common.properties.LanguageType import com.wafflestudio.csereal.core.research.dto.ResearchDto import com.wafflestudio.csereal.core.resource.attachment.database.AttachmentEntity import com.wafflestudio.csereal.core.resource.mainImage.database.MainImageEntity @@ -13,6 +14,9 @@ class ResearchEntity( @Enumerated(EnumType.STRING) var postType: ResearchPostType, + @Enumerated(EnumType.STRING) + var language: LanguageType, + var name: String, @Column(columnDefinition = "mediumText") @@ -34,9 +38,10 @@ class ResearchEntity( override fun bringAttachments() = attachments companion object { - fun of(researchDto: ResearchDto): ResearchEntity { + fun of(languageType: LanguageType, researchDto: ResearchDto): ResearchEntity { return ResearchEntity( postType = researchDto.postType, + language = languageType, name = researchDto.name, description = researchDto.description ) 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 c1190f39..11325c04 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 @@ -1,5 +1,6 @@ package com.wafflestudio.csereal.core.research.dto +import com.wafflestudio.csereal.common.properties.LanguageType import com.wafflestudio.csereal.core.research.database.ResearchEntity import com.wafflestudio.csereal.core.research.database.ResearchPostType import com.wafflestudio.csereal.core.resource.attachment.dto.AttachmentResponse @@ -8,6 +9,7 @@ import java.time.LocalDateTime data class ResearchDto( val id: Long, val postType: ResearchPostType, + val language: String, val name: String, val description: String?, val createdAt: LocalDateTime?, @@ -21,6 +23,7 @@ data class ResearchDto( ResearchDto( id = this.id, postType = this.postType, + language = LanguageType.makeLowercase(entity.language), name = this.name, description = this.description, createdAt = this.createdAt, diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/research/service/ResearchService.kt b/src/main/kotlin/com/wafflestudio/csereal/core/research/service/ResearchService.kt index 2dc97539..2b9bcfc6 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/research/service/ResearchService.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/research/service/ResearchService.kt @@ -2,6 +2,7 @@ package com.wafflestudio.csereal.core.research.service import com.wafflestudio.csereal.common.CserealException import com.wafflestudio.csereal.common.properties.EndpointProperties +import com.wafflestudio.csereal.common.properties.LanguageType import com.wafflestudio.csereal.core.member.database.ProfessorRepository import com.wafflestudio.csereal.core.research.database.* import com.wafflestudio.csereal.core.research.dto.* @@ -58,7 +59,8 @@ class ResearchServiceImpl( mainImage: MultipartFile?, attachments: List? ): ResearchDto { - val newResearch = ResearchEntity.of(request) + val enumLanguageType = LanguageType.makeStringToLanguageType(request.language) + val newResearch = ResearchEntity.of(enumLanguageType, request) if (request.labs != null) { for (lab in request.labs) { @@ -292,7 +294,8 @@ class ResearchServiceImpl( override fun migrateResearchDetail(requestList: List): List { val list = mutableListOf() for (request in requestList) { - val newResearch = ResearchEntity.of(request) + val enumLanguageType = LanguageType.makeStringToLanguageType(request.language) + val newResearch = ResearchEntity.of(enumLanguageType, request) newResearch.researchSearch = ResearchSearchEntity.create(newResearch) 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 bbb1e43c..c906e49c 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 @@ -1,5 +1,6 @@ package com.wafflestudio.csereal.core.member.service +import com.wafflestudio.csereal.common.properties.LanguageType import com.wafflestudio.csereal.core.member.database.MemberSearchRepository import com.wafflestudio.csereal.core.member.database.ProfessorRepository import com.wafflestudio.csereal.core.member.database.ProfessorStatus @@ -35,6 +36,7 @@ class ProfessorServiceTest( val date = LocalDate.now() val researchEntity = ResearchEntity( + language = LanguageType.KO, name = "researchName", description = null, postType = ResearchPostType.LABS @@ -134,6 +136,7 @@ class ProfessorServiceTest( Given("생성되어 있는 간단한 교수에 대하여") { val date = LocalDate.now() val researchEntity = ResearchEntity( + language = LanguageType.KO, name = "researchName", description = null, postType = ResearchPostType.LABS 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 df6eb464..8fc32018 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 @@ -44,6 +44,7 @@ class ResearchServiceTest( Given("간단한 Research를 생성하려고 할 때") { val researchDto = ResearchDto( id = -1, + language = "ko", name = "name", postType = ResearchPostType.CENTERS, description = "description", @@ -93,6 +94,7 @@ class ResearchServiceTest( Given("간단한 Research를 수정하려고 할 때") { val researchDto = ResearchDto( id = -1, + language = "ko", name = "name", postType = ResearchPostType.CENTERS, description = "description", @@ -112,6 +114,7 @@ class ResearchServiceTest( When("Research를 수정한다면") { val researchUpdateRequest = ResearchDto( id = createdResearchDto.id, + language = "ko", name = "name2", postType = ResearchPostType.GROUPS, description = "description2", @@ -189,6 +192,7 @@ class ResearchServiceTest( // Save research val research = researchRepository.save( ResearchEntity( + language = LanguageType.KO, name = "research", postType = ResearchPostType.GROUPS, description = null @@ -293,6 +297,7 @@ class ResearchServiceTest( // Save research val research = researchRepository.save( ResearchEntity( + language = LanguageType.KO, name = "research", postType = ResearchPostType.GROUPS, description = null From d4eded70cea27a6ea50f9d36ca9135fa9f645bd3 Mon Sep 17 00:00:00 2001 From: "DESKTOP-USQPRVG\\gram" Date: Sun, 25 Feb 2024 14:14:50 +0900 Subject: [PATCH 6/7] =?UTF-8?q?feat:=20lab=EC=97=90=20language=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../csereal/core/research/database/LabEntity.kt | 5 ++++- .../com/wafflestudio/csereal/core/research/dto/LabDto.kt | 3 +++ .../csereal/core/research/service/ResearchService.kt | 6 ++++-- .../csereal/core/member/service/ProfessorServiceTest.kt | 3 +++ .../core/reseach/service/ResearchSearchServiceTest.kt | 4 ++++ .../csereal/core/reseach/service/ResearchServiceTest.kt | 2 ++ 6 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/research/database/LabEntity.kt b/src/main/kotlin/com/wafflestudio/csereal/core/research/database/LabEntity.kt index 78d59a55..66daa817 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/research/database/LabEntity.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/research/database/LabEntity.kt @@ -1,6 +1,7 @@ package com.wafflestudio.csereal.core.research.database import com.wafflestudio.csereal.common.config.BaseTimeEntity +import com.wafflestudio.csereal.common.properties.LanguageType import com.wafflestudio.csereal.core.member.database.ProfessorEntity import com.wafflestudio.csereal.core.research.dto.LabDto import com.wafflestudio.csereal.core.research.dto.LabUpdateRequest @@ -9,6 +10,7 @@ import jakarta.persistence.* @Entity(name = "lab") class LabEntity( + var language: LanguageType, var name: String, @OneToMany(mappedBy = "lab") @@ -36,8 +38,9 @@ class LabEntity( ) : BaseTimeEntity() { companion object { - fun of(labDto: LabDto, researchGroup: ResearchEntity): LabEntity { + fun of(languageType: LanguageType, labDto: LabDto, researchGroup: ResearchEntity): LabEntity { return LabEntity( + language = languageType, name = labDto.name, location = labDto.location, tel = labDto.tel, diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/research/dto/LabDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/research/dto/LabDto.kt index 9060bd3f..19126f2b 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/research/dto/LabDto.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/research/dto/LabDto.kt @@ -1,9 +1,11 @@ package com.wafflestudio.csereal.core.research.dto +import com.wafflestudio.csereal.common.properties.LanguageType import com.wafflestudio.csereal.core.research.database.LabEntity data class LabDto( val id: Long, + val language: String, val name: String, val professors: List?, val location: String?, @@ -19,6 +21,7 @@ data class LabDto( fun of(entity: LabEntity, pdfURL: String): LabDto = entity.run { LabDto( id = this.id, + language = LanguageType.makeLowercase(entity.language), name = this.name, professors = this.professors.map { LabProfessorResponse(id = it.id, name = it.name) }, location = this.location, diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/research/service/ResearchService.kt b/src/main/kotlin/com/wafflestudio/csereal/core/research/service/ResearchService.kt index 2b9bcfc6..59c473e3 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/research/service/ResearchService.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/research/service/ResearchService.kt @@ -184,7 +184,8 @@ class ResearchServiceImpl( throw CserealException.Csereal404("해당 게시글은 연구그룹이어야 합니다.") } - val newLab = LabEntity.of(request, researchGroup) + val enumLanguageType = LanguageType.makeStringToLanguageType(request.language) + val newLab = LabEntity.of(enumLanguageType, request, researchGroup) if (request.professors != null) { for (professor in request.professors) { @@ -318,7 +319,8 @@ class ResearchServiceImpl( throw CserealException.Csereal404("해당 게시글은 연구그룹이어야 합니다.") } - val newLab = LabEntity.of(request, researchGroup) + val enumLanguageType = LanguageType.makeStringToLanguageType(request.language) + val newLab = LabEntity.of(enumLanguageType, request, researchGroup) newLab.researchSearch = ResearchSearchEntity.create(newLab) 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 c906e49c..09329eb3 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 @@ -42,6 +42,7 @@ class ProfessorServiceTest( postType = ResearchPostType.LABS ) var labEntity = LabEntity( + language = LanguageType.KO, name = "labName", location = null, tel = null, @@ -142,6 +143,7 @@ class ProfessorServiceTest( postType = ResearchPostType.LABS ) val labEntity1 = LabEntity( + language = LanguageType.KO, name = "labName1", location = null, tel = null, @@ -152,6 +154,7 @@ class ProfessorServiceTest( research = researchEntity ) val labEntity2 = LabEntity( + language = LanguageType.KO, name = "labName2", location = null, tel = null, 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 031ec07a..76603b52 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 @@ -1,5 +1,6 @@ package com.wafflestudio.csereal.core.reseach.service +import com.wafflestudio.csereal.common.properties.LanguageType import com.wafflestudio.csereal.core.member.database.ProfessorRepository import com.wafflestudio.csereal.core.member.database.ProfessorStatus import com.wafflestudio.csereal.core.member.dto.ProfessorDto @@ -94,6 +95,7 @@ class ResearchSearchServiceTest( // Save research val research = researchRepository.save( ResearchEntity( + language = LanguageType.KO, name = "research", postType = ResearchPostType.GROUPS, description = null @@ -103,6 +105,7 @@ class ResearchSearchServiceTest( // Save lab val labDto = LabDto( id = -1, + language = "ko", name = "name", professors = listOf( LabProfessorResponse(professor1.id, professor1.name), @@ -120,6 +123,7 @@ class ResearchSearchServiceTest( val emptyLabDto = LabDto( id = -1, + language = "ko", name = "nameE", professors = listOf(), acronym = "acronymE", 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 8fc32018..fe7a8538 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 @@ -201,6 +201,7 @@ class ResearchServiceTest( val labDto = LabDto( id = -1, + language = "ko", name = "name", professors = listOf( LabProfessorResponse(professor1.id, professor1.name), @@ -307,6 +308,7 @@ class ResearchServiceTest( // Save lab val labDto = LabDto( id = -1, + language = "ko", name = "name", professors = listOf( LabProfessorResponse(professor1.id, professor1.name), From 2d956dfa7fe14da527d40409764a9abadf8b1efa Mon Sep 17 00:00:00 2001 From: "DESKTOP-USQPRVG\\gram" Date: Wed, 28 Feb 2024 12:47:04 +0900 Subject: [PATCH 7/7] =?UTF-8?q?fix:=20about,=20admission=20migrate=20searc?= =?UTF-8?q?h=20todo=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wafflestudio/csereal/core/about/service/AboutService.kt | 5 +++++ .../csereal/core/admissions/service/AdmissionsService.kt | 1 + 2 files changed, 6 insertions(+) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/about/service/AboutService.kt b/src/main/kotlin/com/wafflestudio/csereal/core/about/service/AboutService.kt index c63b6c3a..9df0a60f 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/about/service/AboutService.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/about/service/AboutService.kt @@ -156,6 +156,7 @@ class AboutServiceImpl( @Transactional override fun migrateAbout(requestList: List): List { + // Todo: add about migrate search val list = mutableListOf() for (request in requestList) { @@ -188,6 +189,7 @@ class AboutServiceImpl( @Transactional override fun migrateFutureCareers(request: FutureCareersRequest): FutureCareersPage { + // Todo: add about migrate search val description = request.description val language = request.language val statList = mutableListOf() @@ -248,6 +250,7 @@ class AboutServiceImpl( @Transactional override fun migrateStudentClubs(requestList: List): List { + // Todo: add about migrate search val list = mutableListOf() for (request in requestList) { @@ -278,6 +281,7 @@ class AboutServiceImpl( @Transactional override fun migrateFacilities(requestList: List): List = + // Todo: add about migrate search requestList.map { AboutDto( id = null, @@ -305,6 +309,7 @@ class AboutServiceImpl( @Transactional override fun migrateDirections(requestList: List): List { + // Todo: add about migrate search val list = mutableListOf() for (request in requestList) { diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/admissions/service/AdmissionsService.kt b/src/main/kotlin/com/wafflestudio/csereal/core/admissions/service/AdmissionsService.kt index a31e65d3..63d7a98d 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/admissions/service/AdmissionsService.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/admissions/service/AdmissionsService.kt @@ -67,6 +67,7 @@ class AdmissionsServiceImpl( @Transactional override fun migrateAdmissions(requestList: List) = requestList.map { + // Todo: add admission migrate search val mainType = AdmissionsMainType.fromJsonValue(it.mainType) val postType = AdmissionsPostType.fromJsonValue(it.postType) val language = LanguageType.makeStringToLanguageType(it.language)