Skip to content

Commit

Permalink
[FEATURE] #30 UserDataSource, UserRepository - GetUserStarred 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
eshc123 committed Sep 29, 2022
1 parent 7f13a86 commit 0713242
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions data/src/main/java/com/eshc/data/repository/UserRepositoryImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,22 @@ class UserRepositoryImpl @Inject constructor(
}
}
}

override fun getStarred(): Single<Result<Int>> {
try {
return userDataSource.getUserStarred()
.map {
it.getOrThrow().run {
Result.success(this)
}
}
.onErrorReturn {
Result.failure(it.cause ?: Throwable())
}
} catch (e: Exception) {
return Single.create {
Result.failure<String>(e)
}
}
}
}

0 comments on commit 0713242

Please sign in to comment.