Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ data class ReportRequestDto(
@SerialName("reportContent")
val reportContent: String,
@SerialName("reportCategory")
val reportCategory: String,
val reportCategory: ReportCategory,
@SerialName("reportImageUrls")
val reportImageUrls: List<String>,
@SerialName("reportLocation")
Expand All @@ -27,7 +27,7 @@ fun Report.toDto(): ReportRequestDto {
return ReportRequestDto(
reportTitle = this.title,
reportContent = this.content,
reportCategory = ReportCategory.toString(this.category),
reportCategory = this.category,
reportImageUrls = this.imageUrls,
reportLocation = this.address,
latitude = this.latitude,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ class ReportDetailDto(
@SerialName("reportDate")
val reportDate: String,
@SerialName("reportStatus")
val reportStatus: String,
val reportStatus: ReportStatus,
@SerialName("reportTitle")
val reportTitle: String,
@SerialName("reportContent")
val reportContent: String,
@SerialName("reportCategory")
val reportCategory: String,
val reportCategory: ReportCategory,
@SerialName("reportLocation")
val reportLocation: String,
@SerialName("reportImageUrls")
Expand All @@ -29,10 +29,10 @@ fun ReportDetailDto.toDomain(id: String?): ReportDetail =
ReportDetail(
id = id ?: "",
date = LocalDate.parse(this.reportDate),
status = ReportStatus.fromString(this.reportStatus),
status = this.reportStatus,
title = this.reportTitle,
content = this.reportContent,
category = ReportCategory.fromString(this.reportCategory),
category = this.reportCategory,
address = this.reportLocation,
imageUrls = this.reportImageUrls,
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ data class ReportItemDto(
@SerialName("reportId")
val reportId: Int,
@SerialName("reportStatus")
val reportStatus: String,
val reportStatus: ReportStatus,
@SerialName("reportTitle")
val reportTitle: String,
@SerialName("reportCategory")
val reportCategory: String,
val reportCategory: ReportCategory,
@SerialName("reportLocation")
val reportLocation: String,
@SerialName("reportImageUrl")
Expand All @@ -25,9 +25,9 @@ data class ReportItemDto(
fun ReportItemDto.toDomain(): ReportItem =
ReportItem(
id = this.reportId,
status = ReportStatus.fromString(this.reportStatus),
status = this.reportStatus,
title = this.reportTitle,
category = ReportCategory.fromString(this.reportCategory),
category = this.reportCategory,
address = this.reportLocation,
imageUrl = this.reportImageUrl,
)
2 changes: 2 additions & 0 deletions domain/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
plugins {
alias(libs.plugins.bitnagil.kotlin)
alias(libs.plugins.kotlin.serialization)
}

dependencies {
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.javax.inject)
testImplementation(libs.junit)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,12 @@
package com.threegap.bitnagil.domain.report.model

import kotlinx.serialization.Serializable

@Serializable
enum class ReportCategory {
TRANSPORTATION,
LIGHTING,
WATERFACILITY,
AMENITY,
;

companion object {
fun fromString(value: String): ReportCategory {
return when (value) {
"TRANSPORTATION" -> TRANSPORTATION
"LIGHTING" -> LIGHTING
"WATERFACILITY" -> WATERFACILITY
"AMENITY" -> AMENITY
else -> throw IllegalArgumentException("Invalid ReportCategory value: $value")
}
}

fun toString(value: ReportCategory): String {
return when (value) {
TRANSPORTATION -> "TRANSPORTATION"
LIGHTING -> "LIGHTING"
WATERFACILITY -> "WATERFACILITY"
AMENITY -> "AMENITY"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
package com.threegap.bitnagil.domain.report.model

import kotlinx.serialization.Serializable

@Serializable
enum class ReportStatus {
Pending,
InProgress,
Completed,
PENDING,
IN_PROGRESS,
COMPLETED,
;

companion object {
fun fromString(value: String): ReportStatus {
return when (value) {
"PENDING" -> Pending
"IN_PROGRESS" -> InProgress
"COMPLETED" -> Completed
else -> throw IllegalArgumentException("Invalid ReportStatus value: $value")
}
}

fun toString(value: ReportStatus): String {
return when (value) {
Pending -> "PENDING"
InProgress -> "IN_PROGRESS"
Completed -> "COMPLETED"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ enum class ReportProcess(
companion object {
fun fromDomain(status: ReportStatus): ReportProcess {
return when (status) {
ReportStatus.Pending -> Reported
ReportStatus.InProgress -> Progress
ReportStatus.Completed -> Complete
ReportStatus.PENDING -> Reported
ReportStatus.IN_PROGRESS -> Progress
ReportStatus.COMPLETED -> Complete
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ enum class ReportProcess(
companion object {
fun fromDomain(status: ReportStatus): ReportProcess {
return when (status) {
ReportStatus.Pending -> Reported
ReportStatus.InProgress -> Progress
ReportStatus.Completed -> Complete
ReportStatus.PENDING -> Reported
ReportStatus.IN_PROGRESS -> Progress
ReportStatus.COMPLETED -> Complete
}
}
}
Expand Down