diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/academics/api/AcademicsController.kt b/src/main/kotlin/com/wafflestudio/csereal/core/academics/api/AcademicsController.kt index 53fe6f59..89f907c5 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/academics/api/AcademicsController.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/academics/api/AcademicsController.kt @@ -79,11 +79,11 @@ class AcademicsController( return ResponseEntity.ok(academicsService.readCourse(language, name)) } - @GetMapping("/undergraduate/general-studies-requirements") - fun readGeneralStudiesRequirements( + @GetMapping("/undergraduate/degree-requirements") + fun readDegreeRequirements( @RequestParam(required = false, defaultValue = "ko") language: String - ): ResponseEntity { - return ResponseEntity.ok(academicsService.readGeneralStudies(language)) + ): ResponseEntity { + return ResponseEntity.ok(academicsService.readDegreeRequirements(language)) } @AuthenticatedStaff diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsEntity.kt b/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsEntity.kt index 23339598..a3b87160 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsEntity.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsEntity.kt @@ -22,7 +22,6 @@ class AcademicsEntity( @Column(columnDefinition = "mediumText") var description: String, var year: Int?, - var time: String?, @OneToMany(mappedBy = "academics", cascade = [CascadeType.ALL], orphanRemoval = true) var attachments: MutableList = mutableListOf(), @@ -46,8 +45,7 @@ class AcademicsEntity( language = languageType, name = academicsDto.name, description = academicsDto.description, - year = academicsDto.year, - time = academicsDto.time + year = academicsDto.year ) } } diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsPostType.kt b/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsPostType.kt index 432ea6c6..fb77471f 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsPostType.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsPostType.kt @@ -2,5 +2,5 @@ package com.wafflestudio.csereal.core.academics.database enum class AcademicsPostType { GUIDE, GENERAL_STUDIES_REQUIREMENTS, GENERAL_STUDIES_REQUIREMENTS_SUBJECT_CHANGES, - CURRICULUM, DEGREE_REQUIREMENTS, COURSE_CHANGES, SCHOLARSHIP; + CURRICULUM, DEGREE_REQUIREMENTS, DEGREE_REQUIREMENTS_YEAR_LIST, COURSE_CHANGES, SCHOLARSHIP; } diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsRepository.kt b/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsRepository.kt index c3a578d5..2aeeb80e 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsRepository.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsRepository.kt @@ -14,9 +14,4 @@ interface AcademicsRepository : JpaRepository { studentType: AcademicsStudentType, postType: AcademicsPostType ): List - fun findAllByLanguageAndStudentTypeAndPostTypeOrderByTimeDesc( - languageType: LanguageType, - studentType: AcademicsStudentType, - postType: AcademicsPostType - ): List } diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsSearchEntity.kt b/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsSearchEntity.kt index ce50ce3b..6b4d59ce 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsSearchEntity.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/academics/database/AcademicsSearchEntity.kt @@ -47,7 +47,6 @@ class AcademicsSearchEntity( fun createContent(academics: AcademicsEntity): String { val sb = StringBuilder() academics.name.let { sb.appendLine(it) } - academics.time?.let { sb.appendLine(it) } academics.year?.let { sb.appendLine(it) } sb.appendLine(academics.studentType.value) sb.appendLine( diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/AcademicsDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/AcademicsDto.kt index 1530c621..38091e05 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/AcademicsDto.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/AcademicsDto.kt @@ -11,7 +11,6 @@ data class AcademicsDto( val name: String, val description: String, val year: Int? = null, - val time: String? = null, val createdAt: LocalDateTime? = null, val modifiedAt: LocalDateTime? = null, val attachments: List? = null @@ -24,7 +23,6 @@ data class AcademicsDto( name = this.name, description = this.description, year = this.year, - time = this.time, createdAt = this.createdAt, modifiedAt = this.modifiedAt, attachments = attachmentResponses diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/SubjectChangesDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/DegreeRequirementsDto.kt similarity index 72% rename from src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/SubjectChangesDto.kt rename to src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/DegreeRequirementsDto.kt index 6d362ac8..e5c531a5 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/SubjectChangesDto.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/DegreeRequirementsDto.kt @@ -2,14 +2,14 @@ package com.wafflestudio.csereal.core.academics.dto import com.wafflestudio.csereal.core.academics.database.AcademicsEntity -class SubjectChangesDto( - val time: String, +class DegreeRequirementsDto( + val year: Int, val description: String ) { companion object { fun of(entity: AcademicsEntity) = entity.run { - SubjectChangesDto( - time = this.time!!, + DegreeRequirementsDto( + year = this.year!!, description = this.description ) } diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/DegreeRequirementsPageResponse.kt b/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/DegreeRequirementsPageResponse.kt new file mode 100644 index 00000000..8d4d2ad4 --- /dev/null +++ b/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/DegreeRequirementsPageResponse.kt @@ -0,0 +1,17 @@ +package com.wafflestudio.csereal.core.academics.dto + +import com.wafflestudio.csereal.core.academics.database.AcademicsEntity + +class DegreeRequirementsPageResponse( + val description: String, + val yearList: List +) { + companion object { + fun of(entity: AcademicsEntity, yearList: List) = entity.run { + DegreeRequirementsPageResponse( + description = this.description, + yearList = yearList.map { DegreeRequirementsDto.of(it) } + ) + } + } +} diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/GeneralStudiesPageResponse.kt b/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/GeneralStudiesPageResponse.kt deleted file mode 100644 index 950434f2..00000000 --- a/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/GeneralStudiesPageResponse.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.wafflestudio.csereal.core.academics.dto - -import com.wafflestudio.csereal.core.academics.database.AcademicsEntity - -class GeneralStudiesPageResponse( - val subjectChanges: List, - val description: String -) { - companion object { - fun of(entity: AcademicsEntity, subjectChangesEntity: List) = entity.run { - GeneralStudiesPageResponse( - subjectChanges = subjectChangesEntity.map { SubjectChangesDto.of(it) }, - description = this.description - ) - } - } -} diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/academics/service/AcademicsService.kt b/src/main/kotlin/com/wafflestudio/csereal/core/academics/service/AcademicsService.kt index a4878db5..d2be6702 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/academics/service/AcademicsService.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/academics/service/AcademicsService.kt @@ -26,7 +26,7 @@ interface AcademicsService { studentType: String, postType: String ): List - fun readGeneralStudies(language: String): GeneralStudiesPageResponse + fun readDegreeRequirements(language: String): DegreeRequirementsPageResponse fun createCourse( studentType: String, request: CourseDto, @@ -139,22 +139,23 @@ class AcademicsServiceImpl( } @Transactional(readOnly = true) - override fun readGeneralStudies(language: String): GeneralStudiesPageResponse { + override fun readDegreeRequirements(language: String): DegreeRequirementsPageResponse { val enumLanguageType = LanguageType.makeStringToLanguageType(language) val academicsEntity = academicsRepository.findByLanguageAndStudentTypeAndPostType( enumLanguageType, AcademicsStudentType.UNDERGRADUATE, - AcademicsPostType.GENERAL_STUDIES_REQUIREMENTS + AcademicsPostType.DEGREE_REQUIREMENTS ) - val subjectChangesList = - academicsRepository.findAllByLanguageAndStudentTypeAndPostTypeOrderByTimeDesc( + + val yearList = + academicsRepository.findAllByLanguageAndStudentTypeAndPostTypeOrderByYearDesc( enumLanguageType, AcademicsStudentType.UNDERGRADUATE, - AcademicsPostType.GENERAL_STUDIES_REQUIREMENTS_SUBJECT_CHANGES + AcademicsPostType.DEGREE_REQUIREMENTS_YEAR_LIST ) - return GeneralStudiesPageResponse.of(academicsEntity, subjectChangesList) + return DegreeRequirementsPageResponse.of(academicsEntity, yearList) } @Transactional