Skip to content

Commit

Permalink
♻️ Move toDomain() functions inside DTOs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lysoun committed Feb 20, 2024
1 parent f23c63d commit d47ce02
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ data class EnvironmentCreationRequestDtoV1(
val smallName: String,
@Serializable(with = UUIDSerializer::class)
val projectRef: UUID
)
) {
fun toDomain() = EnvironmentCreationRequest(
name = this.name,
smallName = this.smallName,
fkProjectRef = this.projectRef
)
}

fun EnvironmentCreationRequestDtoV1.toDomain() = EnvironmentCreationRequest(
name = this.name,
smallName = this.smallName,
fkProjectRef = this.projectRef
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package rest.v1.route.environment
import environment.EnvironmentNameUpdateRequest

@kotlinx.serialization.Serializable
data class EnvironmentNameUpdateRequestDtoV1(val name: String, val smallName: String)

fun EnvironmentNameUpdateRequestDtoV1.toDomain() = EnvironmentNameUpdateRequest(
name = this.name,
smallName = this.smallName
)
data class EnvironmentNameUpdateRequestDtoV1(val name: String, val smallName: String) {
fun toDomain() = EnvironmentNameUpdateRequest(
name = this.name,
smallName = this.smallName
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ data class ModuleCreationRequestDtoV1(
val name: String,
@Serializable(with = UUIDSerializer::class)
val projectRef: UUID
)

fun ModuleCreationRequestDtoV1.toDomain(): ModuleCreationRequest = ModuleCreationRequest(
name = this.name,
fkProjectRef = this.projectRef
)
) {
fun toDomain(): ModuleCreationRequest = ModuleCreationRequest(
name = this.name,
fkProjectRef = this.projectRef
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import kotlinx.serialization.Serializable
import module.ModuleNameUpdateRequest

@Serializable
data class ModuleNameUpdateRequestDtoV1(val name: String)

fun ModuleNameUpdateRequestDtoV1.toDomain(): ModuleNameUpdateRequest = ModuleNameUpdateRequest(
name = this.name
)
data class ModuleNameUpdateRequestDtoV1(val name: String) {
fun toDomain(): ModuleNameUpdateRequest = ModuleNameUpdateRequest(
name = this.name
)
}

0 comments on commit d47ce02

Please sign in to comment.