Skip to content

Commit c1a3855

Browse files
committed
🚚 String의 toRule() 확장함수 domain layer로 이동
1 parent f44317a commit c1a3855

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed
Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.whyranoid.data.model
22

3-
import com.whyranoid.domain.model.DayOfWeek
4-
import com.whyranoid.domain.model.Rule
53
import com.whyranoid.domain.model.User
64

75
data class UserResponse(
@@ -17,12 +15,3 @@ fun UserResponse.toUser() =
1715
name = this.name,
1816
profileUrl = this.profileUrl
1917
)
20-
21-
fun String.toRule(): Rule {
22-
val ruleString = this.split("-")
23-
return Rule(
24-
dayOfWeek = DayOfWeek.values().find { it.dayResId == ruleString[0] } ?: DayOfWeek.SUN,
25-
hour = ruleString[1].toInt(),
26-
minute = ruleString[2].toInt()
27-
)
28-
}

data/src/main/java/com/whyranoid/data/user/UserDataSource.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import com.whyranoid.data.constant.Exceptions.NO_USER_EXCEPTION
99
import com.whyranoid.data.model.GroupInfoResponse
1010
import com.whyranoid.data.model.UserResponse
1111
import com.whyranoid.data.model.toGroupInfo
12-
import com.whyranoid.data.model.toRule
1312
import com.whyranoid.data.model.toUser
1413
import com.whyranoid.domain.model.GroupInfo
14+
import com.whyranoid.domain.model.toRule
1515
import kotlinx.coroutines.channels.awaitClose
1616
import kotlinx.coroutines.flow.Flow
1717
import kotlinx.coroutines.flow.callbackFlow

domain/src/main/java/com/whyranoid/domain/model/Rule.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ data class Rule(
1010
}
1111
}
1212

13+
fun String.toRule(): Rule {
14+
val ruleString = this.split("-")
15+
return Rule(
16+
dayOfWeek = DayOfWeek.values().find { it.dayResId == ruleString[0] } ?: DayOfWeek.SUN,
17+
hour = ruleString[1].toInt(),
18+
minute = ruleString[2].toInt()
19+
)
20+
}
21+
1322
enum class DayOfWeek(val dayResId: String) {
1423
MON(""),
1524
TUE(""),

0 commit comments

Comments
 (0)