Skip to content

Commit

Permalink
Merge pull request #223 from School-of-Company/feature/222-modify-tra…
Browse files Browse the repository at this point in the history
…ining-part-api

🔀 :: (#222) - Training 부분 API 변동사항을 수정했습니다.
  • Loading branch information
audgns10 authored Nov 30, 2024
2 parents da30b95 + c31a9e5 commit 531432e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.school_of_company.model.entity.training

data class TrainingProgramListResponseEntity(
val essential: List<Training>,
val choice: List<Training>
) {
data class Training(
val title: String,
val startedAt: String,
val endedAt: String,
)
}
val id: Long,
val title: String,
val startedAt: String,
val endedAt: String,
val category: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
data class TrainingProgramListResponse(
@Json(name = "essential") val essential: List<Training>,
@Json(name = "choice") val choice: List<Training>
) {
data class Training(
@Json(name = "title") val title: String,
@Json(name = "startedAt") val startedAt: String,
@Json(name = "endedAt") val endedAt: String
)
}
@Json(name = "id") val id: Long,
@Json(name = "title") val title: String,
@Json(name = "startedAt") val startedAt: String,
@Json(name = "endedAt") val endedAt: String,
@Json(name = "category") val category: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ import com.squareup.moshi.Json

fun TrainingProgramListResponse.toEntity(): TrainingProgramListResponseEntity =
TrainingProgramListResponseEntity(
essential = this.essential.map { it.toEntity() },
choice = this.choice.map { it.toEntity() }
)

fun TrainingProgramListResponse.Training.toEntity(): TrainingProgramListResponseEntity.Training =
TrainingProgramListResponseEntity.Training(
id = this.id,
title = this.title,
startedAt = this.startedAt,
endedAt = this.endedAt
endedAt = this.endedAt,
category = this.category
)

0 comments on commit 531432e

Please sign in to comment.