Skip to content

Commit

Permalink
Feat: Move type to type dir, and add main type enum.
Browse files Browse the repository at this point in the history
  • Loading branch information
huGgW committed Feb 10, 2024
1 parent 48edba4 commit dfe4654
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.wafflestudio.csereal.core.admissions.type

import com.wafflestudio.csereal.common.CserealException

enum class AdmissionsMainType {
UNDERGRADUATE,
GRADUATE,
INTERNATIONAL;

fun toJsonValue() = this.name.lowercase()

companion object {
fun fromJsonValue(field: String) = try {
field
.uppercase()
.let { AdmissionsMainType.valueOf(it) }
} catch (e: IllegalArgumentException) {
throw CserealException.Csereal400("존재하지 않는 Admission Main Type입니다.")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.wafflestudio.csereal.core.admissions.type

import com.wafflestudio.csereal.common.CserealException

enum class AdmissionsPostType {
// For graduate, undergraduate
EARLY_ADMISSION,
REGULAR_ADMISSION,

// For international
UNDERGRADUATE,
GRADUATE,
EXCHANGE_VISITING,
SCHOLARSHIPS;

fun toJsonValue() = this.name.lowercase()

companion object {
fun fromJsonValue(field: String) =
try {
field.replace('_', '-')
.uppercase()
.let { AdmissionsPostType.valueOf(it) }
} catch (e: IllegalArgumentException) {
throw CserealException.Csereal400("잘못된 Admission Post Type이 주어졌습니다.")
}
}
}

0 comments on commit dfe4654

Please sign in to comment.