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 3fe5367f..6bbcf2fd 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 @@ -217,6 +217,7 @@ class AboutServiceImpl( @Transactional override fun migrateAbout(requestList: List): List { + // Todo: add about migrate search val list = mutableListOf() for (request in requestList) { @@ -250,6 +251,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() @@ -312,6 +314,7 @@ class AboutServiceImpl( @Transactional override fun migrateStudentClubs(requestList: List): List { + // Todo: add about migrate search val list = mutableListOf() for (request in requestList) { @@ -343,6 +346,7 @@ class AboutServiceImpl( @Transactional override fun migrateFacilities(requestList: List): List = + // Todo: add about migrate search requestList.map { AboutDto( id = null, @@ -372,6 +376,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) 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/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/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/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..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 @@ -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) { @@ -182,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) { @@ -292,7 +295,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) @@ -315,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 bbb1e43c..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 @@ -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,11 +36,13 @@ class ProfessorServiceTest( val date = LocalDate.now() val researchEntity = ResearchEntity( + language = LanguageType.KO, name = "researchName", description = null, postType = ResearchPostType.LABS ) var labEntity = LabEntity( + language = LanguageType.KO, name = "labName", location = null, tel = null, @@ -134,11 +137,13 @@ class ProfessorServiceTest( Given("생성되어 있는 간단한 교수에 대하여") { val date = LocalDate.now() val researchEntity = ResearchEntity( + language = LanguageType.KO, name = "researchName", description = null, postType = ResearchPostType.LABS ) val labEntity1 = LabEntity( + language = LanguageType.KO, name = "labName1", location = null, tel = null, @@ -149,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 df6eb464..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 @@ -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 @@ -197,6 +201,7 @@ class ResearchServiceTest( val labDto = LabDto( id = -1, + language = "ko", name = "name", professors = listOf( LabProfessorResponse(professor1.id, professor1.name), @@ -293,6 +298,7 @@ class ResearchServiceTest( // Save research val research = researchRepository.save( ResearchEntity( + language = LanguageType.KO, name = "research", postType = ResearchPostType.GROUPS, description = null @@ -302,6 +308,7 @@ class ResearchServiceTest( // Save lab val labDto = LabDto( id = -1, + language = "ko", name = "name", professors = listOf( LabProfessorResponse(professor1.id, professor1.name),