Skip to content

Commit

Permalink
fix: readGeneralStudiesRequirements 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
skfotakf committed Mar 12, 2024
1 parent 34d6ade commit 8aaa337
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ class AcademicsController(
return ResponseEntity.ok(academicsService.readGuide(language, studentType))
}

@GetMapping("/undergraduate/general-studies-requirements")
fun readGeneralStudiesRequirements(
@RequestParam(required = false, defaultValue = "ko") language: String
): ResponseEntity<GeneralStudiesRequirementsPageResponse> {
return ResponseEntity.ok(academicsService.readGeneralStudiesRequirements(language))
}

@GetMapping("/{studentType}/{postType}")
fun readAcademicsYearResponses(
@RequestParam(required = false, defaultValue = "ko") language: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.wafflestudio.csereal.core.academics.dto

import com.wafflestudio.csereal.core.academics.database.AcademicsEntity

class GeneralStudiesRequirementsPageResponse(
val description: String
) {
companion object {
fun of(entity: AcademicsEntity): GeneralStudiesRequirementsPageResponse = entity.run {
GeneralStudiesRequirementsPageResponse(
description = this.description
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ interface AcademicsService {
studentType: String,
postType: String
): List<AcademicsYearResponse>
fun readGeneralStudiesRequirements(language: String): GeneralStudiesRequirementsPageResponse
fun readDegreeRequirements(language: String): DegreeRequirementsPageResponse
fun createCourse(
studentType: String,
Expand Down Expand Up @@ -138,6 +139,19 @@ class AcademicsServiceImpl(
return academicsYearResponses
}

@Transactional(readOnly = true)
override fun readGeneralStudiesRequirements(language: String): GeneralStudiesRequirementsPageResponse {
val enumLanguageType = LanguageType.makeStringToLanguageType(language)
val academicsEntity =
academicsRepository.findByLanguageAndStudentTypeAndPostType(
enumLanguageType,
AcademicsStudentType.UNDERGRADUATE,
AcademicsPostType.GENERAL_STUDIES_REQUIREMENTS
)

return GeneralStudiesRequirementsPageResponse.of(academicsEntity)
}

@Transactional(readOnly = true)
override fun readDegreeRequirements(language: String): DegreeRequirementsPageResponse {
val enumLanguageType = LanguageType.makeStringToLanguageType(language)
Expand Down

0 comments on commit 8aaa337

Please sign in to comment.