From de702f1b06552b4338700aac04bcc1bc336a6c4e Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Wed, 27 Mar 2024 19:52:10 +0900 Subject: [PATCH] =?UTF-8?q?[refactor]=20=EC=BD=94=EB=93=9C=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/network/calladapter/ResultCallAdapter.kt | 2 +- .../data/repository/CourseRepositoryImpl.kt | 12 ++++++------ .../runnect/domain/repository/CourseRepository.kt | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/data/network/calladapter/ResultCallAdapter.kt b/app/src/main/java/com/runnect/runnect/data/network/calladapter/ResultCallAdapter.kt index 5c65e150..fba1d638 100644 --- a/app/src/main/java/com/runnect/runnect/data/network/calladapter/ResultCallAdapter.kt +++ b/app/src/main/java/com/runnect/runnect/data/network/calladapter/ResultCallAdapter.kt @@ -10,7 +10,7 @@ class ResultCallAdapter( override fun responseType() = responseType - // Retrofit의 Call을 Flow<>로 변환 + // Retrofit의 Call을 Result<>로 변환 override fun adapt(call: Call): Call> { return ResultCall(call) } diff --git a/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt b/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt index c6fa6a41..e166327e 100644 --- a/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt +++ b/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt @@ -38,7 +38,7 @@ class CourseRepositoryImpl @Inject constructor(private val remoteCourseDataSourc override suspend fun getRecommendCourse( pageNo: String, sort: String - ): kotlin.Result = runCatching { + ): Result = runCatching { val response = remoteCourseDataSource.getRecommendCourse( pageNo = pageNo, sort = sort @@ -49,12 +49,12 @@ class CourseRepositoryImpl @Inject constructor(private val remoteCourseDataSourc } } - override suspend fun getCourseSearch(keyword: String): kotlin.Result?> = + override suspend fun getCourseSearch(keyword: String): Result?> = runCatching { remoteCourseDataSource.getCourseSearch(keyword = keyword).data?.toDiscoverSearchCourses() } - override suspend fun getMyCourseLoad(): kotlin.Result?> = + override suspend fun getMyCourseLoad(): Result?> = runCatching { remoteCourseDataSource.getMyCourseLoad().data?.toUploadCourses() } @@ -87,14 +87,14 @@ class CourseRepositoryImpl @Inject constructor(private val remoteCourseDataSourc override suspend fun getCourseDetail( publicCourseId: Int - ): kotlin.Result = runCatching { + ): Result = runCatching { remoteCourseDataSource.getCourseDetail(publicCourseId = publicCourseId).data?.toCourseDetail() } override suspend fun patchPublicCourse( publicCourseId: Int, requestPatchPublicCourse: RequestPatchPublicCourse - ): kotlin.Result = runCatching { + ): Result = runCatching { remoteCourseDataSource.patchPublicCourse( publicCourseId = publicCourseId, requestPatchPublicCourse = requestPatchPublicCourse @@ -103,7 +103,7 @@ class CourseRepositoryImpl @Inject constructor(private val remoteCourseDataSourc override suspend fun postCourseScrap( requestPostCourseScrap: RequestPostCourseScrap - ): kotlin.Result = runCatching { + ): Result = runCatching { remoteCourseDataSource.postCourseScrap(requestPostCourseScrap = requestPostCourseScrap).data } } \ No newline at end of file diff --git a/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt b/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt index ebaf16c0..fd89760f 100644 --- a/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt +++ b/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt @@ -23,16 +23,16 @@ import okhttp3.RequestBody import retrofit2.Response interface CourseRepository { - suspend fun getMarathonCourse(): Flow>> + suspend fun getMarathonCourse(): Flow>> suspend fun getRecommendCourse( pageNo: String, sort: String - ): kotlin.Result + ): Result - suspend fun getCourseSearch(keyword: String): kotlin.Result?> + suspend fun getCourseSearch(keyword: String): Result?> - suspend fun getMyCourseLoad(): kotlin.Result?> + suspend fun getMyCourseLoad(): Result?> suspend fun postUploadMyCourse(requestPostPublicCourse: RequestPostPublicCourse): ResponsePostDiscoverUpload @@ -46,12 +46,12 @@ interface CourseRepository { image: MultipartBody.Part, data: RequestBody ): Response - suspend fun getCourseDetail(publicCourseId: Int): kotlin.Result + suspend fun getCourseDetail(publicCourseId: Int): Result suspend fun patchPublicCourse( publicCourseId: Int, requestPatchPublicCourse: RequestPatchPublicCourse - ): kotlin.Result + ): Result - suspend fun postCourseScrap(requestPostCourseScrap: RequestPostCourseScrap): kotlin.Result + suspend fun postCourseScrap(requestPostCourseScrap: RequestPostCourseScrap): Result } \ No newline at end of file