Skip to content

Commit

Permalink
[feat]: 개발자 상세 조회 API 성공
Browse files Browse the repository at this point in the history
  • Loading branch information
kangyuri1114 committed May 9, 2024
1 parent 8fb5b4e commit fc7e8eb
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,50 @@ data class DevelopersDetailResponse(
val id: Int,
@SerialName("name")
val name: String,
@SerialName("imageLink")
val imageLink: String,
@SerialName("developerList")
val developerList: List<DeveloperInfoInDevelopersDetail>,
@SerialName("shortIntro")
val shortIntro: String,
@SerialName("longIntro")
val longIntro: String,
@SerialName("category")
val category: String,
@SerialName("university")
val university: String,
@SerialName("major")
val major: String,
@SerialName("studentNumber")
val studentNumber: String,
@SerialName("email")
val email: String,
@SerialName("hits")
val hits: Int,
@SerialName("kakaoId")
val kakaoId: String,
@SerialName("githubLink")
val githubLink: String,
@SerialName("infoPageLink")
val infoPageLink: String,
@SerialName("webLink")
val webLink: String,
@SerialName("appLink")
val appLink: String,
@SerialName("projectList")
val projectsListInDevelopersDetail: List<ProjectsListInDevelopersDetail>,
@SerialName("languageList")
val languageList: List<String>,
@SerialName("devToolList")
val devToolList: List<String>,
@SerialName("techStackList")
val techStackList: List<String>,
@SerialName("part1")
val part1: String?,
@SerialName("part2")
val part2: String?,
@SerialName("developer")
val developer: Boolean,
) {
@Serializable
data class DeveloperInfoInDevelopersDetail(
data class ProjectsListInDevelopersDetail(
@SerialName("id")
val id: Int,
@SerialName("name")
val name: String,
@SerialName("partList")
val partList: List<String>,
@SerialName("imageLink")
val imageLink: String,
@SerialName("shortIntro")
val shortIntro: String,
@SerialName("category")
val category: String,
@SerialName("hits")
val hits: Int,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ data class DevelopersListResponse(
@SerialName("name")
val name: String,
@SerialName("part1")
val part1: String,
val part1: String?,
@SerialName("part2")
val part2: String,
val part2: String?,
@SerialName("githubLink")
val githubLink: String,
@SerialName("hits")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.sample.network.model.BaseResponse
import com.sample.network.reponse.DevelopersDetailResponse
import com.sample.network.reponse.DevelopersListResponse
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query

interface DevelopersService {
Expand All @@ -17,6 +18,6 @@ interface DevelopersService {

@GET("/api/developers/{developerId}")
suspend fun getDevelopersDetailData(
developerId: Int,
@Path("developerId") developerId: Int,
): BaseResponse<DevelopersDetailResponse>
}
23 changes: 14 additions & 9 deletions data/src/main/java/com/zucchini/mapper/DevelopersDetail.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,34 @@ import com.zucchini.domain.model.DeveloperInfoInDetailModel
import com.zucchini.domain.model.DevelopersDetailModel

internal fun DevelopersDetailResponse.toDevelopersDetailModel(): DevelopersDetailModel {
val developerList = developerList.map { developerInfo ->
val projectsListInDevelopersDetail = projectsListInDevelopersDetail.map { developerInfo ->
DeveloperInfoInDetailModel(
id = developerInfo.id,
name = developerInfo.name,
partList = developerInfo.partList,
imageLink = developerInfo.imageLink,
shortIntro = developerInfo.shortIntro,
category = developerInfo.category,
hits = developerInfo.hits,
)
}

return DevelopersDetailModel(
id = id,
name = name,
imageLink = imageLink,
developerList = developerList,
shortIntro = shortIntro,
longIntro = longIntro,
category = category,
university = university,
major = major,
studentNumber = studentNumber,
email = email,
hits = hits,
kakaoId = kakaoId,
githubLink = githubLink,
infoPageLink = infoPageLink,
webLink = webLink,
appLink = appLink,
projectList = projectsListInDevelopersDetail,
languageList = languageList,
devToolList = devToolList,
techStackList = techStackList,
part1 = part1,
part2 = part2,
developer = developer,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,28 @@ package com.zucchini.domain.model
data class DevelopersDetailModel(
val id: Int,
val name: String,
val imageLink: String,
val developerList: List<DeveloperInfoInDetailModel>,
val shortIntro: String,
val longIntro: String,
val category: String,
val university: String,
val major: String,
val studentNumber: String,
val email: String,
val hits: Int,
val kakaoId: String,
val githubLink: String,
val infoPageLink: String,
val webLink: String,
val appLink: String,
val projectList: List<DeveloperInfoInDetailModel>,
val languageList: List<String>,
val devToolList: List<String>,
val techStackList: List<String>
val techStackList: List<String>,
val part1: String?,
val part2: String?,
val developer: Boolean,
)

data class DeveloperInfoInDetailModel(
val id: Int,
val name: String,
val partList: List<String>
val imageLink: String,
val shortIntro: String,
val category: String,
val hits: Int,
)

Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ data class DevelopersListModel(
data class DeveloperDetailInfoInListModel(
val id: Int,
val name: String,
val part1: String,
val part2: String,
val part1: String?,
val part2: String?,
val githubLink: String,
val hits: Int,
)
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DevDetailViewModel @Inject constructor(
_developersDetail.value = it
Timber.tag("DevDetailViewModel").d(it.toString())
}.onFailure {
// handle error
Timber.tag("DevDetailViewModel Fail").d(it.toString())
}
}
}
Expand Down

0 comments on commit fc7e8eb

Please sign in to comment.