Skip to content

Commit ff8c1c5

Browse files
committed
Merge branch 'feature/resolve-conflict-240502' into develop
2 parents 474d4a1 + 1d98350 commit ff8c1c5

File tree

79 files changed

+1365
-1359
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1365
-1359
lines changed

app/src/main/java/com/runnect/runnect/data/dto/LocationData.kt

Lines changed: 0 additions & 11 deletions
This file was deleted.

app/src/main/java/com/runnect/runnect/data/dto/LoginDTO.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.runnect.runnect.data.dto
22

33
data class LoginDTO(
4-
val status: Int,
54
val accessToken: String,
65
val refreshToken: String,
76
val email: String,

app/src/main/java/com/runnect/runnect/data/dto/response/ResponseGetMyDrawCourse.kt

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@ import kotlinx.serialization.Serializable
77
@Serializable
88
data class ResponseGetMyDrawCourse(
99
@SerialName("courses")
10-
val courses: List<Course>,
10+
val courses: List<Course>?,
1111
@SerialName("user")
12-
val user: User,
12+
val user: User?,
1313
) {
1414
@Serializable
1515
data class Course(
1616
@SerialName("createdAt")
17-
val createdAt: String,
17+
val createdAt: String?,
1818
@SerialName("departure")
19-
val departure: Departure,
19+
val departure: Departure?,
2020
@SerialName("id")
21-
val id: Int,
21+
val id: Int?,
2222
@SerialName("image")
23-
val image: String,
23+
val image: String?,
2424
@SerialName("title")
25-
val title: String
25+
val title: String?
2626
) {
2727
@Serializable
2828
data class Departure(
2929
@SerialName("city")
30-
val city: String,
30+
val city: String?,
3131
@SerialName("region")
32-
val region: String,
32+
val region: String?,
3333
)
3434
}
3535

@@ -41,13 +41,17 @@ data class ResponseGetMyDrawCourse(
4141
}
4242

4343
fun ResponseGetMyDrawCourse.toMyDrawCourse(): List<MyDrawCourse> {
44-
return this.courses.map {
45-
MyDrawCourse(
46-
courseId = it.id,
47-
image = it.image,
48-
city = it.departure.city,
49-
region = it.departure.region,
50-
title = it.title
51-
)
44+
45+
return if (this.courses.isNullOrEmpty()) emptyList()
46+
else {
47+
this.courses.map {
48+
MyDrawCourse(
49+
courseId = it.id,
50+
image = it.image,
51+
city = it.departure?.city ?: "", //todo - 예외 처리 논의
52+
region = it.departure?.region ?: "",
53+
title = it.title ?: ""
54+
)
55+
}
5256
}
5357
}
Lines changed: 61 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,72 @@
11
package com.runnect.runnect.data.dto.response
22

3+
import com.runnect.runnect.data.dto.HistoryInfoDTO
34
import kotlinx.serialization.SerialName
45
import kotlinx.serialization.Serializable
56

67
@Serializable
78
data class ResponseGetMyHistory(
8-
val `data`: HistoryData,
9-
val message: String,
10-
val status: Int,
11-
val success: Boolean
12-
)
9+
val user: RecordUser,
10+
val records: List<Record>,
11+
) {
12+
@Serializable
13+
data class RecordUser(
14+
@SerialName("userId") val id: Int
15+
)
1316

14-
@Serializable
15-
data class Record(
16-
val courseId: Int,
17-
val createdAt: String,
18-
val departure: Departure,
19-
val distance: Double,
20-
val id: Int,
21-
val image: String,
22-
val pace: String,
23-
val publicCourseId: Int?,
24-
val time: String,
25-
val title: String
26-
)
17+
@Serializable
18+
data class Record(
19+
val courseId: Int,
20+
val createdAt: String,
21+
val departure: Departure,
22+
val distance: Double,
23+
val id: Int,
24+
val image: String,
25+
val pace: String,
26+
val publicCourseId: Int?,
27+
val time: String,
28+
val title: String
29+
) {
30+
@Serializable
31+
data class Departure(
32+
val city: String,
33+
val region: String
34+
)
35+
}
2736

28-
@Serializable
29-
data class Departure(
30-
val city: String,
31-
val region: String
32-
)
37+
fun toHistoryInfoList(): List<HistoryInfoDTO> {
38+
return records.map {
39+
HistoryInfoDTO(
40+
id = it.id,
41+
img = it.image,
42+
title = it.title,
43+
location = "${it.departure.region} ${it.departure.city}",
44+
date = (it.createdAt.split(" ")[0]).replace("-", "."),
45+
distance = it.distance.toString(),
46+
time = timeConvert(it.time),
47+
pace = paceConvert(it.pace)
48+
)
49+
}
50+
}
3351

34-
@Serializable
35-
data class RecordUser(
36-
@SerialName("userId") val id: Int
37-
)
38-
39-
@Serializable
40-
data class HistoryData(
41-
val records: List<Record>,
42-
val user: RecordUser
43-
)
52+
private fun timeConvert(time: String): String {
53+
val hms = time.split(":").toMutableList()
54+
if (hms[0] == "00") {
55+
hms[0] = "0"
56+
}
57+
return "${hms[0]}:${hms[1]}:${hms[2]}"
58+
}
4459

60+
private fun paceConvert(p: String): String {
61+
val pace = p.split(":").toMutableList()
62+
return if (pace[0] == "00") {
63+
pace.removeAt(0)
64+
if (pace[0][0] == '0') {
65+
pace[0] = pace[0][1].toString()
66+
}
67+
"${pace[0]}${pace[1]}"
68+
} else {
69+
"${pace[0]}${pace[1]}${pace[2]}"
70+
}
71+
}
72+
}
Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
package com.runnect.runnect.data.dto.response
2+
23
import kotlinx.serialization.Serializable
34

45
@Serializable
56
data class ResponseGetMyStamp(
6-
val `data`: StampData,
7-
val message: String,
8-
val status: Int,
9-
val success: Boolean
10-
)
11-
12-
@Serializable
13-
data class StampData(
7+
val user: StampUser,
148
val stamps: List<Stamp>,
15-
val user: StampUser
16-
)
9+
) {
10+
@Serializable
11+
data class StampUser(
12+
val id: Int
13+
)
1714

18-
@Serializable
19-
data class Stamp(
20-
val id: String
21-
)
15+
@Serializable
16+
data class Stamp(
17+
val id: String
18+
)
2219

23-
@Serializable
24-
data class StampUser(
25-
val id: Int
26-
)
20+
fun toStampList() = stamps.map { it.id }
21+
}
Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
package com.runnect.runnect.data.dto.response
22

3+
import com.runnect.runnect.domain.entity.User
34
import kotlinx.serialization.Serializable
45

56
@Serializable
67
data class ResponseGetUser(
7-
val data: Data,
8-
val message: String,
9-
val status: Int,
10-
val success: Boolean
11-
)
8+
val user: UserResponse,
9+
) {
1210

13-
@Serializable
14-
data class Data(
15-
val user: User
16-
)
11+
@Serializable
12+
data class UserResponse(
13+
val email: String,
14+
val latestStamp: String,
15+
val level: Int,
16+
val levelPercent: Int,
17+
val nickname: String
18+
)
1719

18-
@Serializable
19-
data class User(
20-
val email:String,
21-
val latestStamp: String,
22-
val level: Int,
23-
val levelPercent: Int,
24-
val nickname: String
25-
)
20+
fun toUser(): User {
21+
return User(
22+
email = user.email,
23+
latestStamp = user.latestStamp,
24+
level = user.level,
25+
levelPercent = user.levelPercent,
26+
nickname = user.nickname
27+
)
28+
}
29+
}
Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,53 @@
11
package com.runnect.runnect.data.dto.response
22

33
import com.google.gson.annotations.SerializedName
4+
import com.runnect.runnect.domain.entity.UserUploadCourse
45
import kotlinx.serialization.Serializable
56

67
@Serializable
78
data class ResponseGetUserUploadCourse(
8-
@SerializedName("data")
9-
val `data`: DataUpload,
10-
@SerializedName("message")
11-
val message: String,
12-
@SerializedName("status")
13-
val status: Int,
14-
@SerializedName("success")
15-
val success: Boolean
16-
)
17-
@Serializable
18-
data class UserUpload(
19-
@SerializedName("id")
20-
val id: Int
21-
)
22-
@Serializable
23-
data class PublicCourseUpload(
24-
@SerializedName("courseId")
25-
val courseId: Int,
26-
@SerializedName("departure")
27-
val departure: DepartureUpload,
28-
@SerializedName("id")
29-
val id: Int,
30-
@SerializedName("image")
31-
val image: String,
32-
@SerializedName("title")
33-
val title: String
34-
)
35-
36-
@Serializable
37-
data class DepartureUpload(
38-
@SerializedName("city")
39-
val city: String,
40-
@SerializedName("region")
41-
val region: String
42-
)
43-
@Serializable
44-
data class DataUpload(
45-
@SerializedName("publicCourse")
46-
val publicCourses: List<PublicCourseUpload>,
479
@SerializedName("user")
48-
val user: UserUpload
49-
)
10+
val user: UserId,
11+
@SerializedName("publicCourses")
12+
val publicCourses: List<PublicCourseUpload>,
13+
) {
14+
15+
@Serializable
16+
data class UserId(
17+
@SerializedName("id")
18+
val id: Int,
19+
)
20+
21+
@Serializable
22+
data class PublicCourseUpload(
23+
@SerializedName("id")
24+
val id: Int,
25+
@SerializedName("courseId")
26+
val courseId: Int,
27+
@SerializedName("title")
28+
val title: String,
29+
@SerializedName("scrap")
30+
val scrap: Boolean,
31+
@SerializedName("image")
32+
val image: String,
33+
@SerializedName("departure")
34+
val departure: DepartureUpload,
35+
)
36+
37+
@Serializable
38+
data class DepartureUpload(
39+
@SerializedName("region")
40+
val region: String,
41+
@SerializedName("city")
42+
val city: String,
43+
)
44+
45+
fun toUserUploadCourse(): List<UserUploadCourse> = publicCourses.map {
46+
UserUploadCourse(
47+
id = it.id,
48+
title = it.title,
49+
img = it.image,
50+
departure = "${it.departure.region} ${it.departure.city}"
51+
)
52+
}
53+
}

0 commit comments

Comments
 (0)