Skip to content

Commit

Permalink
[refactor] 코드 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
dongx0915 committed Mar 27, 2024
1 parent 6df7c73 commit de702f1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ResultCallAdapter<T>(

override fun responseType() = responseType

// Retrofit의 Call을 Flow<>로 변환
// Retrofit의 Call을 Result<>로 변환
override fun adapt(call: Call<T>): Call<Result<T>> {
return ResultCall(call)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CourseRepositoryImpl @Inject constructor(private val remoteCourseDataSourc
override suspend fun getRecommendCourse(
pageNo: String,
sort: String
): kotlin.Result<RecommendCoursePagingData?> = runCatching {
): Result<RecommendCoursePagingData?> = runCatching {
val response = remoteCourseDataSource.getRecommendCourse(
pageNo = pageNo,
sort = sort
Expand All @@ -49,12 +49,12 @@ class CourseRepositoryImpl @Inject constructor(private val remoteCourseDataSourc
}
}

override suspend fun getCourseSearch(keyword: String): kotlin.Result<List<DiscoverSearchCourse>?> =
override suspend fun getCourseSearch(keyword: String): Result<List<DiscoverSearchCourse>?> =
runCatching {
remoteCourseDataSource.getCourseSearch(keyword = keyword).data?.toDiscoverSearchCourses()
}

override suspend fun getMyCourseLoad(): kotlin.Result<List<DiscoverUploadCourse>?> =
override suspend fun getMyCourseLoad(): Result<List<DiscoverUploadCourse>?> =
runCatching {
remoteCourseDataSource.getMyCourseLoad().data?.toUploadCourses()
}
Expand Down Expand Up @@ -87,14 +87,14 @@ class CourseRepositoryImpl @Inject constructor(private val remoteCourseDataSourc

override suspend fun getCourseDetail(
publicCourseId: Int
): kotlin.Result<CourseDetail?> = runCatching {
): Result<CourseDetail?> = runCatching {
remoteCourseDataSource.getCourseDetail(publicCourseId = publicCourseId).data?.toCourseDetail()
}

override suspend fun patchPublicCourse(
publicCourseId: Int,
requestPatchPublicCourse: RequestPatchPublicCourse
): kotlin.Result<EditableCourseDetail?> = runCatching {
): Result<EditableCourseDetail?> = runCatching {
remoteCourseDataSource.patchPublicCourse(
publicCourseId = publicCourseId,
requestPatchPublicCourse = requestPatchPublicCourse
Expand All @@ -103,7 +103,7 @@ class CourseRepositoryImpl @Inject constructor(private val remoteCourseDataSourc

override suspend fun postCourseScrap(
requestPostCourseScrap: RequestPostCourseScrap
): kotlin.Result<ResponsePostScrap?> = runCatching {
): Result<ResponsePostScrap?> = runCatching {
remoteCourseDataSource.postCourseScrap(requestPostCourseScrap = requestPostCourseScrap).data
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ import okhttp3.RequestBody
import retrofit2.Response

interface CourseRepository {
suspend fun getMarathonCourse(): Flow<kotlin.Result<List<MarathonCourse>>>
suspend fun getMarathonCourse(): Flow<Result<List<MarathonCourse>>>

suspend fun getRecommendCourse(
pageNo: String,
sort: String
): kotlin.Result<RecommendCoursePagingData?>
): Result<RecommendCoursePagingData?>

suspend fun getCourseSearch(keyword: String): kotlin.Result<List<DiscoverSearchCourse>?>
suspend fun getCourseSearch(keyword: String): Result<List<DiscoverSearchCourse>?>

suspend fun getMyCourseLoad(): kotlin.Result<List<DiscoverUploadCourse>?>
suspend fun getMyCourseLoad(): Result<List<DiscoverUploadCourse>?>

suspend fun postUploadMyCourse(requestPostPublicCourse: RequestPostPublicCourse): ResponsePostDiscoverUpload

Expand All @@ -46,12 +46,12 @@ interface CourseRepository {
image: MultipartBody.Part, data: RequestBody
): Response<ResponsePostMyDrawCourse>

suspend fun getCourseDetail(publicCourseId: Int): kotlin.Result<CourseDetail?>
suspend fun getCourseDetail(publicCourseId: Int): Result<CourseDetail?>

suspend fun patchPublicCourse(
publicCourseId: Int,
requestPatchPublicCourse: RequestPatchPublicCourse
): kotlin.Result<EditableCourseDetail?>
): Result<EditableCourseDetail?>

suspend fun postCourseScrap(requestPostCourseScrap: RequestPostCourseScrap): kotlin.Result<ResponsePostScrap?>
suspend fun postCourseScrap(requestPostCourseScrap: RequestPostCourseScrap): Result<ResponsePostScrap?>
}

0 comments on commit de702f1

Please sign in to comment.