-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feat/#160 정책 api 마이그레이션
- Loading branch information
Showing
51 changed files
with
1,013 additions
and
329 deletions.
There are no files selected for viewing
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
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
104 changes: 0 additions & 104 deletions
104
core/data/src/main/kotlin/com/withpeace/withpeace/core/data/mapper/YouthPolicyMapper.kt
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
...rc/main/kotlin/com/withpeace/withpeace/core/data/mapper/youthpolicy/PolicyDetailMapper.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,31 @@ | ||
package com.withpeace.withpeace.core.data.mapper.youthpolicy | ||
|
||
import com.withpeace.withpeace.core.domain.model.policy.PolicyClassification | ||
import com.withpeace.withpeace.core.domain.model.policy.YouthPolicyDetail | ||
import com.withpeace.withpeace.core.network.di.response.policy.PolicyDetailResponse | ||
|
||
internal fun PolicyDetailResponse.toDomain(): YouthPolicyDetail { | ||
return YouthPolicyDetail( | ||
id = id, | ||
title = title, | ||
introduce = introduce, | ||
ageInfo = ageInfo, | ||
classification = classification.codeToPolicyClassification(), | ||
|
||
applicationDetails = applicationDetails, | ||
residenceAndIncome = residenceAndIncome, | ||
education = education, | ||
specialization = specialization, | ||
additionalNotes = additionalNotes, | ||
participationRestrictions = participationRestrictions, | ||
applicationProcess = applicationProcess, | ||
screeningAndAnnouncement = screeningAndAnnouncement, | ||
applicationSite = applicationSite, | ||
submissionDocuments = submissionDocuments, | ||
additionalUsefulInformation = additionalUsefulInformation, | ||
supervisingAuthority = supervisingAuthority, | ||
operatingOrganization = operatingOrganization, | ||
businessRelatedReferenceSite1 = businessRelatedReferenceSite1, | ||
businessRelatedReferenceSite2 = businessRelatedReferenceSite2, | ||
) | ||
} |
60 changes: 60 additions & 0 deletions
60
...data/src/main/kotlin/com/withpeace/withpeace/core/data/mapper/youthpolicy/PolicyMapper.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,60 @@ | ||
package com.withpeace.withpeace.core.data.mapper.youthpolicy | ||
|
||
import com.withpeace.withpeace.core.domain.model.policy.PolicyClassification | ||
import com.withpeace.withpeace.core.domain.model.policy.PolicyRegion | ||
import com.withpeace.withpeace.core.domain.model.policy.YouthPolicy | ||
import com.withpeace.withpeace.core.network.di.response.policy.PolicyResponse | ||
|
||
internal fun PolicyResponse.toDomain(): YouthPolicy { | ||
return YouthPolicy( | ||
id = id, | ||
title = title, | ||
introduce = introduce, | ||
region = region.codeToRegion(), | ||
policyClassification = classification.codeToPolicyClassification(), | ||
ageInfo = ageInfo, | ||
) | ||
} | ||
|
||
internal fun String?.codeToRegion(): PolicyRegion { | ||
return PolicyRegion.entries.find { it.toString() == this } ?: PolicyRegion.기타 | ||
} | ||
|
||
internal fun PolicyRegion.toCode(): String { | ||
return when (this) { | ||
PolicyRegion.중앙부처 -> "003001" | ||
PolicyRegion.서울 -> "003002001" | ||
PolicyRegion.부산 -> "003002002" | ||
PolicyRegion.대구 -> "003002003" | ||
PolicyRegion.인천 -> "003002004" | ||
PolicyRegion.광주 -> "003002005" | ||
PolicyRegion.대전 -> "003002006" | ||
PolicyRegion.울산 -> "003002007" | ||
PolicyRegion.경기 -> "003002008" | ||
PolicyRegion.강원 -> "003002009" | ||
PolicyRegion.충북 -> "003002010" | ||
PolicyRegion.충남 -> "003002011" | ||
PolicyRegion.전북 -> "003002012" | ||
PolicyRegion.전남 -> "003002013" | ||
PolicyRegion.경북 -> "003002014" | ||
PolicyRegion.경남 -> "003002015" | ||
PolicyRegion.제주 -> "003002016" | ||
PolicyRegion.세종 -> "003002017" | ||
PolicyRegion.기타 -> throw IllegalStateException("찾을 수 없는 지역입니다.") | ||
} | ||
} | ||
|
||
internal fun String?.codeToPolicyClassification(): PolicyClassification { | ||
return PolicyClassification.entries.find { it.toString() == this } ?: PolicyClassification.ETC | ||
} | ||
|
||
internal fun PolicyClassification.toCode(): String { | ||
return when (this) { | ||
PolicyClassification.JOB -> "023010" | ||
PolicyClassification.RESIDENT -> "023020" | ||
PolicyClassification.EDUCATION -> "023030" | ||
PolicyClassification.WELFARE_AND_CULTURE -> "023040" | ||
PolicyClassification.PARTICIPATION_AND_RIGHT -> "023050" | ||
PolicyClassification.ETC -> throw IllegalStateException("정책 분류를 찾을 수 없습니다.") | ||
} | ||
} |
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
Oops, something went wrong.