|
| 1 | +package com.threegap.bitnagil.data.report.model.response |
| 2 | + |
| 3 | +import com.threegap.bitnagil.domain.report.model.ReportCategory |
| 4 | +import com.threegap.bitnagil.domain.report.model.ReportDetail |
| 5 | +import com.threegap.bitnagil.domain.report.model.ReportStatus |
| 6 | +import kotlinx.serialization.SerialName |
| 7 | +import kotlinx.serialization.Serializable |
| 8 | +import java.time.LocalDate |
| 9 | + |
| 10 | +@Serializable |
| 11 | +class ReportDetailDto( |
| 12 | + @SerialName("reportDate") |
| 13 | + val reportDate: String, |
| 14 | + @SerialName("reportStatus") |
| 15 | + val reportStatus: String, |
| 16 | + @SerialName("reportTitle") |
| 17 | + val reportTitle: String, |
| 18 | + @SerialName("reportContent") |
| 19 | + val reportContent: String, |
| 20 | + @SerialName("reportCategory") |
| 21 | + val reportCategory: String, |
| 22 | + @SerialName("reportLocation") |
| 23 | + val reportLocation: String, |
| 24 | + @SerialName("reportImageUrls") |
| 25 | + val reportImageUrls: List<String>, |
| 26 | +) |
| 27 | + |
| 28 | +fun ReportDetailDto.toDomain(id: String?): ReportDetail = |
| 29 | + ReportDetail( |
| 30 | + id = id ?: "", |
| 31 | + date = LocalDate.parse(this.reportDate), |
| 32 | + status = ReportStatus.fromString(this.reportStatus), |
| 33 | + title = this.reportTitle, |
| 34 | + content = this.reportContent, |
| 35 | + category = ReportCategory.fromString(this.reportCategory), |
| 36 | + address = this.reportLocation, |
| 37 | + imageUrls = this.reportImageUrls, |
| 38 | + ) |
0 commit comments