Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REFACTOR] 코스 상세페이지 / 전면 리팩토링 #275

Merged
merged 66 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
6e46a0f
[FIX] #267 onBackPressed 함수 대신에 OnBackPressedCallback 등록하여 뒤로가기 이벤트에 …
leeeha Oct 25, 2023
60b407c
[REFACTOR] #267 이전 화면이 무엇인지 구분할 때, 문자열 대신 enum class 사용하도록 변경
leeeha Oct 25, 2023
09013d5
[MOD] #267 자신이 업로드한 코스의 상세페이지에서 더보기 버튼 누르면 바텀시트 대신 팝업메뉴 뜨도록 변경
leeeha Oct 25, 2023
9ddb864
[REFACTOR] #267 코스 상세페이지 액티비티에서 addListener 함수 안의 코드 -> 별개의 함수들로 분리
leeeha Oct 25, 2023
39f2bcc
[REFACTOR] #267 if-else 대신에 early return 하도록 변경 (depth 줄어들도록)
leeeha Oct 25, 2023
c3721c3
[CHORE] #267 코스 상세페이지에서 러닝 시작하는 버튼의 id 이름 변경 (finish 대신 start 사용하도록)
leeeha Oct 25, 2023
ce9ee6b
[CHORE] #267 문자열 확장 함수 사용하도록 변경
leeeha Oct 25, 2023
60074cc
[MOD] #267 코스 상세페이지 조회하는 서버통신 코드에서 Data Layer 수정
leeeha Oct 26, 2023
e6ac2d8
[MOD] #267 코스 상세페이지 조회하는 뷰모델 코드 수정
leeeha Oct 26, 2023
da6d3a6
[REFACTOR] #267 코스 상세페이지 조회한 데이터를 액티비티에 반영하는 코드 리팩토링
leeeha Oct 26, 2023
1bb7c61
[REFACTOR] #267 옵저버 함수들 모듈화
leeeha Oct 26, 2023
e629b75
[CHORE] #267 암시적 인텐트로 웹 브라우저 띄워주는 함수 이름 변경
leeeha Oct 26, 2023
7a9f2df
[CHORE] #267 액티비티에서 관련있는 변수끼리 주석 달아놓기
leeeha Oct 27, 2023
368f5b6
[CHORE] #267 뷰모델에서 관련 있는 변수끼리 주석 달아놓기
leeeha Oct 27, 2023
1fa86eb
Merge branch 'feature/refactor-mypage-running-history-viewmodel' of h…
leeeha Oct 30, 2023
3c04d24
[ADD] #268 뷰모델 파일에 누락된 import문 추가
leeeha Oct 30, 2023
b5ecc09
[REFACTOR] 딥링크 관련 함수 내용 더 작게 분리하기
leeeha Nov 5, 2023
ec6d2b4
[CHORE] 딥링크로부터 앱을 여는 경우에 대한 함수 이름 변경
leeeha Nov 5, 2023
7cbd893
[MOD] #267 코스 상세페이지에서 백버튼 눌렀을 때 처리하는 함수 내용 변경
leeeha Nov 5, 2023
8c0fac1
[CHORE] #267 카톡 링크로 코스 보내는 함수의 선언 위치 변경
leeeha Nov 5, 2023
e3880e5
[MOD] #267 방문자 모드에서 로그인 요청 다이얼로그 띄우는 코드 변경
leeeha Nov 5, 2023
af0bfbe
[CHORE] #267 확장함수, 문자열 리소스 이름 변경
leeeha Nov 7, 2023
db60ecc
Merge branch 'develop' of https://github.com/Runnect/Runnect-Android …
leeeha Nov 7, 2023
211fd0b
[REFACTOR] #267 코스 상세페이지의 루트 화면 구분을 위해 문자열 대신 이넘 클래스 사용하도록 변경
leeeha Nov 7, 2023
d24993a
[DEL] #267 사용하지 않는 바텀시트, 다이얼로그 코드 삭제
leeeha Nov 7, 2023
0159f87
[DEL] #267 코스 상세페이지 뷰모델에서 사용하지 않는 변수 삭제
leeeha Nov 7, 2023
277d9c8
[MOD] #267 코스 제목과 내용을 수정하는 request dto에서 변수의 순서 변경
leeeha Nov 7, 2023
5fc8116
[MOD] #267 코스 상세페이지의 제목, 내용 수정하는 로직 변경
leeeha Nov 7, 2023
efd296f
[REFACTOR] #267 토스트 메시지 문자열 리소스에서 가져와서 띄우기
leeeha Nov 7, 2023
b34ad1b
[FIX] #267 뷰모델의 변수 대신에 서버통신으로 받은 dto 값을 바로 뷰에 보여주도록 변경
leeeha Nov 8, 2023
6d27148
[MOD] #267 BaseResponse 사용하도록 dto 변경
leeeha Nov 8, 2023
bbc5392
[CHORE] #267 코스 수정 request dto 이름 변경
leeeha Nov 8, 2023
0c62da9
[FIX] #267 서버 명세서와 응답값이 상이해서 발생하는 오류 해결
leeeha Nov 8, 2023
7ad6df4
[MOD] #267 코스 수정 서버통신 data layer 코드 변경
leeeha Nov 8, 2023
44c7642
[FIX] #267 바인딩 어댑터 NPE 해결
leeeha Nov 8, 2023
ffe5f8e
[MOD] #267 코스 수정 서버통신에서 뷰모델 코드 변경
leeeha Nov 8, 2023
8316af7
[CHORE] #267 getCourseDetail 함수 호출 시점 변경
leeeha Nov 8, 2023
ec48906
[FIX] #267 서버통신으로 코스 수정하고 나서 뷰 업데이트 하는 코드 변경
leeeha Nov 8, 2023
ad9065f
[REFACTOR] #267 connectedSpots 배열 초기화 하는 for문 수정하여 가독성 향상
leeeha Nov 8, 2023
38703a8
[MOD] #267 업로드한 코스 삭제하는 서버통신 코드 수정
leeeha Nov 8, 2023
0a8d639
[FIX] #267 코스 발견 -> 코스 검색 -> 상세페이지 뒤로가기에 대한 동작 추가하여 에러 해결
leeeha Nov 8, 2023
23466e2
[FIX] #267 뷰 이름 변경
leeeha Nov 8, 2023
e08bd37
[FIX] #267 보관함 스크랩하기 버튼 클릭 시, 코스 발견 화면으로 전환했다가 다시 이전 화면으로 돌아가는 코드 수정
leeeha Nov 8, 2023
a91c6e7
[FIX] #267 코스 발견 탭에서 코스 검색 후 뒤로가기 버튼 누를 때 애니메이션 적용하기
leeeha Nov 8, 2023
4abd40d
[FIX] #267 코스 발견 -> 검색 -> 코스 상세 페이지 -> 뒤로가기 -> 검색 로직 변경
leeeha Nov 8, 2023
64216a8
[FIX] #267 딥링크로부터 코스 상세페이지를 열었을 때, 뒤로가기 동작에 대한 로직 수정
leeeha Nov 8, 2023
a47a4ca
[FIX] #267 코스 삭제하고 나서 이전 화면으로 돌아가는 로직 추가
leeeha Nov 8, 2023
b0edea3
[COMMENT] #267 마이페이지 러닝기록 수정/삭제 후 이전 화면으로 돌아왔을 때 바로 반영되도록 하는 주석 추가
leeeha Nov 8, 2023
8d5e649
[REFACTOR] #267 바인딩 어댑터로 서버 이미지 보여주는 코드 통일시키기
leeeha Nov 8, 2023
7477e9e
[DEL] #267 불필요한 주석 삭제
leeeha Nov 8, 2023
af71841
[DEL] #267 사용하지 않는 블록 삭제
leeeha Nov 8, 2023
5a98517
[DEL] #267 중복되는 레이아웃 파일 삭제
leeeha Nov 8, 2023
c887488
[DEL] #267 사용하지 않는 response extension 삭제
leeeha Nov 8, 2023
9f6a488
[CHORE] #267 onFailure 블록의 인자를 더 구체적인 이름으로 변경
leeeha Nov 12, 2023
079bcc6
Merge branch 'develop' of https://github.com/Runnect/Runnect-Android …
leeeha Nov 12, 2023
dde1011
[MERGE] #267 디벨롭 브랜치와의 충돌 해결
leeeha Nov 12, 2023
90332f1
[REFACTOR] #267 반복되는 로직 함수화
leeeha Nov 12, 2023
6f9c317
[DEL] #267 불필요한 로그 삭제
leeeha Nov 12, 2023
d8e8e30
Merge branch 'develop' of https://github.com/Runnect/Runnect-Android …
leeeha Nov 12, 2023
e7f64db
[MOD] #267 stringOf 확장함수 대신에 getString 그대로 사용하도록 변경
leeeha Nov 12, 2023
52cef0e
Merge branch 'develop' of https://github.com/Runnect/Runnect-Android …
leeeha Nov 15, 2023
3d02900
[CHORE] #267 그레들 파일 공백 라인 조정
leeeha Nov 15, 2023
290f265
[DEL] #267 사용되지 않는 import문 삭제
leeeha Nov 15, 2023
2eb0c18
[MOD] #267 util/custom 패키지 아래에 있는 커스텀 클래스들의 패키지 위치 이동
leeeha Nov 15, 2023
ffa88b2
[FIX] #267 newInstance 함수로 프래그먼트 생성자 만들어서 화면 회전과 같은 상태 변경에 대응할 수 있도록 구현
leeeha Nov 15, 2023
bc34a5d
[FIX] #267 방문자모드 다이얼로그 프래그먼트에도 빈 생성자를 위한 newInstance 함수 정의
leeeha Nov 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'

id 'kotlin-android-extensions'
//serialization
//id 'kotlin-parcelize'

id 'org.jetbrains.kotlin.plugin.serialization' version '1.7.20'
//hilt
id 'dagger.hilt.android.plugin'
//plugin for databinding & hilt

// plugin for data binding, hilt
id 'kotlin-kapt'
//for hiding keys used in manifest

// plugin for hiding keys used in manifest
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'

// Add the Google services Gradle plugin
id("com.google.gms.google-services")
id 'com.google.gms.google-services'
}

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

android {
namespace 'com.runnect.runnect'
compileSdk 33
Expand All @@ -36,6 +41,7 @@ android {
buildConfigField "String", "REMOTE_KEY_APP_VERSION", properties["REMOTE_KEY_APP_VERSION"]

}

buildFeatures {
buildConfig = true
}
Expand All @@ -46,21 +52,23 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

buildFeatures {
dataBinding true
viewBinding true
}
}

dependencies {

implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.8.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.runnect.runnect.data.dto


import android.os.Parcelable
import com.naver.maps.geometry.LatLng
import kotlinx.android.parcel.Parcelize

@Parcelize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.google.gson.annotations.SerializedName
import kotlinx.serialization.Serializable

@Serializable
data class RequestDeleteUploadCourse(
data class RequestDeleteUploadCourseDto(
@SerializedName("publicCourseIdList")
val publicCourseIdList: List<Int>
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import com.google.gson.annotations.SerializedName
import kotlinx.serialization.Serializable

@Serializable
data class RequestUpdatePublicCourse(
data class RequestPatchPublicCourseDto(
@SerializedName("title")
val title: String,
@SerializedName("description")
val description: String,
@SerializedName("title")
val title: String
)

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.runnect.runnect.data.dto.response

import com.google.gson.annotations.SerializedName
import kotlinx.serialization.Serializable
@Serializable
data class ResponseDeleteUploadCourseDto(
@SerializedName("deletedPublicCourseCount")
val deletedPublicCourseCount: Int
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package com.runnect.runnect.data.dto.response


import com.runnect.runnect.domain.entity.CourseDetail
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class ResponseGetCourseDetailDto(
@SerialName("user")
val user: User,
@SerialName("publicCourse")
val publicCourse: PublicCourse
) {
@Serializable
data class User(
@SerialName("nickname")
val nickname: String,
@SerialName("level")
val level: Int,
@SerialName("image")
val image: String,
@SerialName("isNowUser")
val isNowUser: Boolean
)

@Serializable
data class PublicCourse(
@SerialName("id")
val id: Int,
@SerialName("courseId")
val courseId: Int,
@SerialName("scrap")
val scrap: Boolean,
@SerialName("image")
val image: String,
@SerialName("title")
val title: String,
@SerialName("description")
val description: String,
@SerialName("path")
val path: List<List<Double>>,
@SerialName("distance")
val distance: Double,
@SerialName("departure")
val departure: Departure
) {
@Serializable
data class Departure(
@SerialName("region")
val region: String,
@SerialName("city")
val city: String,
@SerialName("town")
val town: String,
@SerialName("name")
val name: String?
)
}

fun toCourseDetail() = CourseDetail(
stampId = user.image,
level = user.level.toString(),
nickname = user.nickname,
isNowUser = user.isNowUser,
id = publicCourse.id,
courseId = publicCourse.courseId,
departure = publicCourse.departure.region + ' ' +
publicCourse.departure.city + ' ' +
publicCourse.departure.town + ' ' +
((publicCourse.departure.name) ?: ""),
description = publicCourse.description,
distance = publicCourse.distance.toString(),
image = publicCourse.image,
isScrap = publicCourse.scrap,
title = publicCourse.title,
path = publicCourse.path
)
Comment on lines +61 to +78
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data 가공 함수를 이렇게 data class 내에 직접 작성하는 것과 확장함수로 따로 빼서 만드는 것 중 어떤 것이 더 나을까요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

데이터 가공 작업은 util 패키지 보다는 data layer에서 진행하는 게 더 좋을 거 같습니다!
관련 없는 dto들을 전부 ResponseExt.kt 파일에 모아두는 것보다는
data layer의 각 dto 파일 안에서 가공 작업을 하는 게 좀 더 관심사가 분리된다는 느낌이 들었는데
어떻게 생각하시는지요!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋은 의견입니다! 그동안 제 개인적인 생각으로 data class는 어떤 data를 다루는 건지 틀을 정의해놓는 공간이라 생각하여 가공 logic(함수)가 같은 파일 내에 담겨있는 게 깔끔하지 못하다고 생각했는데

한편으로는 data "class"니까 안에 함수가 포함돼도 문제될 게 없을 것 같다는 생각도 드네요. 또 같은 파일 내에서 함수를 작성해주는 만큼 변수 참조도 바로 가능해서 사소하지만 더 편할 것 같구요.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

같은 질문을 안드로이드 오픈 채팅방에 올려봤는데 아래와 같은 의견을 받았습니다.

확장 함수는 선언한 파일의 정적 메서드로 생기는 것으로 알고 있어요
그래서 이에 따라 생기는 문제를 알고 쓰시면 될 것 같습니다

확장함수를 쓸 때 유의할 점이 있는지 관련 포스팅을 찾아봤습니다.

  1. https://www.roach-dev.com/kotlin/kotlin_extension_function/
  2. https://todaycode.tistory.com/176

요약하자면,

  1. 의도대로 동작을 안 할 수도 있으니 한 클래스에 대한 확장함수를 만들 때 다른 클래스의 값을 참조하지 않게 하라
  2. 상속 불가능
  3. public 멤버만 참조 가능
  4. 같은 이름의 함수가 클래스 내에 존재할 때 확장함수보다 더 우선순위로 채택이 된다
  5. 정적 바인딩

지금 서버에서 받아온 data를 가공하는 case는 상속 관계가 이루어질 일이 없으니 확장 함수를 써도 문제 될 일(조심해야 할 일)은 없지만 편의상 말씀해 주신 것처럼 data class 내에 함수를 만들어 쓰는 게 더 좋겠다고 느꼈습니다.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

추후에 이것만을 다룬 브랜치를 파서 리팩토링 후 pr 올리면 좋을 것 같습니다.

Copy link
Member

@dongx0915 dongx0915 Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

근데 effective 코틀린에서 확장 함수를 클래스 내에 정의하는 것은 좋지 않다고 나와있는 것 같네요

제가 제안 드린 방법은 DataMapper를 통한 계층간 접근 제한 + 클래스 내부에 Mapper를 정의하여 관계를 명확히 표현하는 것에 초점을 맞춘 방법이었는데, 확장 함수 위치에 대한 건 생각을 못한 것 같습니다! 저도 많이 배워가네요

정리하자면 확장 함수를 클래스 내에 정의하는 것은 좋지 않으니 하은 님이 구현하신 것처럼 Dto 내에 멤버 메소드로 정의하는 것도 괜찮아보입니다.

클래스의 멤버로 Mapper 메소드를 선언한다면 굳이 확장 함수를 쓰지 않아도 될 것 같구요!
확장 함수로 쓸 지, 클래스 내의 멤버 메서드로 쓸 지는 팀 스타일에 맞춰 이용하면 될 것 같아요

개인적으로 확장 함수는 클래스 내부를 건들기 힘들 때 속성이나 메소드를 추가하기 위한 목적이 큰 것 같아서 지금 하은님이 구현해주신 방식이 제일 괜찮아 보이는 것 같습니다!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어디까지를 "하나의 책임"으로 볼 것인지가 논점인 것 같네요. 데이터 정의'만' 하는 것도 하나의 책임으로 볼 것인지, 아니면 구체적으로 어떤 동작(mapping)을 해야만 하나의 책임으로 취급을 해줄 것인지.

이 부분은 저희 팀원끼리 어떤 관점으로 볼 지 정하면 될 것 같아요!

질문 내용도 남길게요~!

Copy link
Member Author

@leeeha leeeha Nov 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다들 코드리뷰에 진심이시군요!!! 정성 있는 코멘트 많이 작성해주셔서 넘 감사합니다 🙇‍♀️🙇‍♀️
앞으로도 디스커션 많이 하면서 같이 배워나가요~~!

Copy link
Contributor

@unam98 unam98 Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

말씀해주신 내용이 서버로 부터 받은 Response 객체가 여러 Domain 모델로 변경될 수 있다는 뜻일까요?

아뇨 그런 의미는 아니었고 단순히 data가 여러 형태로 가공될 수 있는 여지가 제한된다는 점만 언급한 것이었습니다! Response 객체를 다룬다는 상황에만 특정한다면 저도 여러 형태로 가공될 여지는 적거나 없다고 생각합니다!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

근데 effective 코틀린에서 확장 함수를 클래스 내에 정의하는 것은 좋지 않다고 나와있는 것 같네요

링크 감사합니다~! 저는 프리미티브 타입과 같이 클래스 내에 멤버로 함수를 추가할 수 없을 때 확장함수를 쓰는 효용이 있다고 생각하는데요. 클래스 내에 멤버로 추가할 수 있다면 굳이 확장함수를 쓸 이유가 없는 것 같습니다! 아마 적어주신 내용은 한 클래스에 여러 클래스의 확장함수를 멤버로 추가해쓰는 걸 지양하라는 맥락 같은데 맞겠죠?!

저도 하은이 방법이 괜찮은 것 같습니다~!

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,17 @@ import com.google.gson.annotations.SerializedName
import kotlinx.serialization.Serializable

@Serializable
data class ResponseUpdatePublicCourse(
@SerializedName("data")
val `data`: UpdatePublicCourseData,
@SerializedName("message")
val message: String,
@SerializedName("status")
val status: Int,
@SerializedName("success")
val success: Boolean
data class ResponsePatchPublicCourseDto(
@SerializedName("publicCourse")
val publicCourse: PublicCourse
)

@Serializable
data class PublicCourse(
@SerializedName("description")
val description: String,
@SerializedName("id")
val id: Int,
@SerializedName("title")
val title: String
val title: String,
@SerializedName("description")
val description: String
)

@Serializable
data class UpdatePublicCourseData(
@SerializedName("publicCourse")
val publicCourse: PublicCourse
)
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.runnect.runnect.data.repository

import com.runnect.runnect.data.dto.CourseDetailDTO
import com.runnect.runnect.domain.entity.CourseDetail
import com.runnect.runnect.data.dto.CourseLoadInfoDTO
import com.runnect.runnect.data.dto.CourseSearchDTO
import com.runnect.runnect.data.dto.RecommendCourseDTO
import com.runnect.runnect.data.dto.request.RequestCourseScrap
import com.runnect.runnect.data.dto.request.RequestPostRecordDTO
import com.runnect.runnect.data.dto.request.RequestPutMyDrawDTO
import com.runnect.runnect.data.dto.request.RequestUpdatePublicCourse
import com.runnect.runnect.data.dto.request.RequestPatchPublicCourseDto
import com.runnect.runnect.data.dto.request.RequestUploadMyCourse
import com.runnect.runnect.data.dto.response.PublicCourse
import com.runnect.runnect.data.dto.response.ResponseCourseScrap
import com.runnect.runnect.data.dto.response.ResponseGetMyDrawDetailDTO
import com.runnect.runnect.data.dto.response.ResponsePostCourseDTO
import com.runnect.runnect.data.dto.response.ResponsePostRecordDTO
import com.runnect.runnect.data.dto.response.ResponsePutMyDrawDTO
import com.runnect.runnect.data.dto.response.ResponseUpdatePublicCourse
import com.runnect.runnect.data.dto.response.ResponseUploadMyCourse
import com.runnect.runnect.data.source.remote.RemoteCourseDataSource
import com.runnect.runnect.domain.CourseRepository
Expand All @@ -27,37 +27,40 @@ import javax.inject.Inject
class CourseRepositoryImpl @Inject constructor(private val remoteCourseDataSource: RemoteCourseDataSource) :
CourseRepository {
override suspend fun getRecommendCourse(pageNo: String?): MutableList<RecommendCourseDTO> {
return remoteCourseDataSource.getRecommendCourse(pageNo = pageNo).data.publicCourses.map { it.toData() }.toMutableList()
return remoteCourseDataSource.getRecommendCourse(pageNo = pageNo).data.publicCourses.map { it.toData() }
.toMutableList()
}

override suspend fun postCourseScrap(requestCourseScrap: RequestCourseScrap): ResponseCourseScrap {
return remoteCourseDataSource.postCourseScrap(requestCourseScrap = requestCourseScrap)
}

override suspend fun getCourseSearch(keyword: String): MutableList<CourseSearchDTO> {
return remoteCourseDataSource.getCourseSearch(keyword = keyword).data.publicCourses.map { it.toData() }.toMutableList()
return remoteCourseDataSource.getCourseSearch(keyword = keyword).data.publicCourses.map { it.toData() }
.toMutableList()
}

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

override suspend fun getMyCourseLoad(): MutableList<CourseLoadInfoDTO> {
return remoteCourseDataSource.getMyCourseLoad().data.privateCourses.map { it.toData() }.toMutableList()
return remoteCourseDataSource.getMyCourseLoad().data.privateCourses.map { it.toData() }
.toMutableList()
}

override suspend fun postUploadMyCourse(requestUploadMyCourse: RequestUploadMyCourse): ResponseUploadMyCourse {
return remoteCourseDataSource.postUploadMyCourse(requestUploadMyCourse = requestUploadMyCourse)
}

override suspend fun patchUpdatePublicCourse(
override suspend fun patchPublicCourse(
publicCourseId: Int,
requestUpdatePublicCourse: RequestUpdatePublicCourse
): ResponseUpdatePublicCourse {
return remoteCourseDataSource.patchUpdatePublicCourse(
requestPatchPublicCourse: RequestPatchPublicCourseDto
): Result<PublicCourse?> = runCatching {
remoteCourseDataSource.patchPublicCourse(
publicCourseId = publicCourseId,
requestUpdatePublicCourse = requestUpdatePublicCourse
)
requestPatchPublicCourseDto = requestPatchPublicCourse
).data?.publicCourse
}

override suspend fun deleteMyDrawCourse(deleteCourseList: RequestPutMyDrawDTO): Response<ResponsePutMyDrawDTO> {
Expand Down
Loading
Loading