-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #305 from Runnect/feature/feat-get-user-profile
[FEAT] 코스 발견 / 상세페이지 타 유저 프로필 조회
- Loading branch information
Showing
25 changed files
with
519 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
app/src/main/java/com/runnect/runnect/data/dto/ProfileCourseData.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
app/src/main/java/com/runnect/runnect/data/dto/response/ResponseGetUserProfile.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package com.runnect.runnect.data.dto.response | ||
|
||
import com.runnect.runnect.domain.entity.Departure | ||
import com.runnect.runnect.domain.entity.UserCourse | ||
import com.runnect.runnect.domain.entity.UserProfile | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ResponseGetUserProfile( | ||
@SerialName("user") | ||
val user: User, | ||
@SerialName("courses") | ||
val courses: List<CourseData> | ||
) { | ||
@Serializable | ||
data class User( | ||
@SerialName("nickname") | ||
val nickname: String, | ||
@SerialName("level") | ||
val level: Int, | ||
@SerialName("levelPercent") | ||
val levelPercent: Int, | ||
@SerialName("latestStamp") | ||
val latestStamp: String, | ||
@SerialName("userId") | ||
val userId: Int | ||
) | ||
|
||
@Serializable | ||
data class CourseData( | ||
@SerialName("publicCourseId") | ||
val publicCourseId: Int, | ||
@SerialName("courseId") | ||
val courseId: Int, | ||
@SerialName("title") | ||
val title: String, | ||
@SerialName("image") | ||
val image: String, | ||
@SerialName("departure") | ||
val departure: Departure, | ||
@SerialName("scrapTF") | ||
val scrapTF: Boolean, | ||
) { | ||
@Serializable | ||
data class Departure( | ||
@SerialName("region") | ||
val region: String, | ||
@SerialName("city") | ||
val city: String, | ||
@SerialName("town") | ||
val town: String, | ||
@SerialName("name") | ||
val name: String?, | ||
@SerialName("detail") | ||
val detail: String? | ||
) | ||
} | ||
|
||
fun toUserProfile(): UserProfile { | ||
val userCourseLists: List<UserCourse> = courses.map { course -> | ||
UserCourse( | ||
publicCourseId = course.publicCourseId, | ||
courseId = course.courseId, | ||
title = course.title, | ||
image = course.image, | ||
departure = Departure( | ||
region = course.departure.region, | ||
city = course.departure.city, | ||
town = course.departure.town, | ||
detail = course.departure.detail, | ||
name = course.departure.name ?: "" | ||
), | ||
scrapTF = course.scrapTF | ||
) | ||
} | ||
|
||
return UserProfile( | ||
nickname = user.nickname, | ||
level = user.level, | ||
levelPercent = user.levelPercent, | ||
latestStamp = user.latestStamp, | ||
courseData = userCourseLists | ||
) | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/runnect/runnect/data/dto/response/ResponsePostScrap.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.runnect.runnect.data.dto.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ResponsePostScrap( | ||
@SerialName("publicCourseId") | ||
val publicCourseId: Long, | ||
@SerialName("scrapCount") | ||
val scrapCount: Long, | ||
@SerialName("scrapTF") | ||
val scrapTF: Boolean | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
app/src/main/java/com/runnect/runnect/domain/entity/UserProfile.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.runnect.runnect.domain.entity | ||
|
||
data class UserProfile( | ||
val nickname: String, | ||
val level: Int, | ||
val levelPercent: Int, | ||
val latestStamp: String, | ||
val courseData: List<UserCourse> | ||
) | ||
|
||
data class UserCourse( | ||
val publicCourseId: Int, | ||
val courseId: Int, | ||
val title: String, | ||
val image: String, | ||
val departure: Departure, | ||
var scrapTF: Boolean, | ||
) | ||
|
||
data class Departure( | ||
val region: String, | ||
val city: String, | ||
val town: String, | ||
val detail: String?, | ||
val name: String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.