-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8034a0b
commit 01ff480
Showing
6 changed files
with
86 additions
and
10 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
...in/com/bestswlkh0310/graduating/graduatingserver/api/scholarship/ScholarshipController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.bestswlkh0310.graduating.graduatingserver.api.scholarship | ||
|
||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/scholarships") | ||
class ScholarshipController( | ||
private val scholarshipService: ScholarshipService | ||
) { | ||
@GetMapping | ||
fun scholarships() = | ||
scholarshipService.getScholarships() | ||
} |
14 changes: 14 additions & 0 deletions
14
...otlin/com/bestswlkh0310/graduating/graduatingserver/api/scholarship/ScholarshipService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.bestswlkh0310.graduating.graduatingserver.api.scholarship | ||
|
||
import com.bestswlkh0310.graduating.graduatingserver.api.scholarship.res.ScholarshipRes | ||
import com.bestswlkh0310.graduating.graduatingserver.core.scholarship.ScholarshipRepository | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class ScholarshipService( | ||
private val scholarshipRepository: ScholarshipRepository | ||
) { | ||
fun getScholarships(): List<ScholarshipRes> = | ||
scholarshipRepository.findAll() | ||
.map(ScholarshipRes::of) | ||
} |
54 changes: 54 additions & 0 deletions
54
...otlin/com/bestswlkh0310/graduating/graduatingserver/api/scholarship/res/ScholarshipRes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.bestswlkh0310.graduating.graduatingserver.api.scholarship.res | ||
|
||
import com.bestswlkh0310.graduating.graduatingserver.core.scholarship.ScholarshipEntity | ||
import com.bestswlkh0310.graduating.graduatingserver.core.scholarship.ScholarshipEntity.FinancialAidType | ||
import com.bestswlkh0310.graduating.graduatingserver.core.scholarship.ScholarshipEntity.OperatingInstitutionCategory | ||
import java.time.LocalDate | ||
|
||
data class ScholarshipRes( | ||
val id: Long = 0, | ||
val recruitmentStartDate: LocalDate?, | ||
val recruitmentEndDate: LocalDate?, | ||
val productName: String, | ||
val selectionMethodDetails: String?, | ||
val selectionNumberDetails: String?, | ||
val gradeCriteriaDetails: String?, | ||
val incomeCriteriaDetails: String?, | ||
val operatingInstitutionCategory: OperatingInstitutionCategory, | ||
val operatingInstitutionName: String, | ||
val qualificationRestrictionsDetails: String?, | ||
val requiredDocumentsDetails: String?, | ||
val residencyDetails: String?, | ||
val supportDetails: String?, | ||
val recommendationRequiredDetails: String?, | ||
val specificQualificationDetails: String?, | ||
val schoolCategory: List<String>, | ||
val gradeLevel: List<String>, | ||
val financialAidType: FinancialAidType, | ||
val homepageUrl: String, | ||
) { | ||
companion object { | ||
fun of(entity: ScholarshipEntity) = ScholarshipRes( | ||
id = entity.id, | ||
recruitmentStartDate = entity.recruitmentStartDate, | ||
recruitmentEndDate = entity.recruitmentEndDate, | ||
productName = entity.productName, | ||
selectionMethodDetails = entity.selectionMethodDetails, | ||
selectionNumberDetails = entity.selectionNumberDetails, | ||
gradeCriteriaDetails = entity.gradeLevel, | ||
incomeCriteriaDetails = entity.incomeCriteriaDetails, | ||
operatingInstitutionCategory = entity.operatingInstitutionCategory, | ||
operatingInstitutionName = entity.operatingInstitutionName, | ||
qualificationRestrictionsDetails = entity.qualificationRestrictionsDetails, | ||
requiredDocumentsDetails = entity.requiredDocumentsDetails, | ||
residencyDetails = entity.residencyDetails, | ||
supportDetails = entity.supportDetails, | ||
recommendationRequiredDetails = entity.recommendationRequiredDetails, | ||
specificQualificationDetails = entity.specificQualificationDetails, | ||
schoolCategory = entity.schoolCategory?.split("/") ?: emptyList(), | ||
gradeLevel = entity.gradeLevel.split("/"), | ||
financialAidType = entity.financialAidType, | ||
homepageUrl = entity.homepageUrl, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters