Skip to content

Commit

Permalink
Refactor: Change AdmissionsDto by adding columns, to be able to used …
Browse files Browse the repository at this point in the history
…as pure dto.
  • Loading branch information
huGgW committed Feb 10, 2024
1 parent b244133 commit 62d3556
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
package com.wafflestudio.csereal.core.admissions.dto

import com.fasterxml.jackson.annotation.JsonInclude
import com.wafflestudio.csereal.common.properties.LanguageType
import com.wafflestudio.csereal.core.admissions.database.AdmissionsEntity
import java.time.LocalDateTime

data class AdmissionsDto(
@JsonInclude(JsonInclude.Include.NON_NULL)
val id: Long? = null,
val id: Long,
val name: String,
val mainType: String,
val postType: String,
val language: String,
val description: String,
val createdAt: LocalDateTime?,
val modifiedAt: LocalDateTime?
val createdAt: LocalDateTime,
val modifiedAt: LocalDateTime
) {
companion object {
fun of(entity: AdmissionsEntity): AdmissionsDto = entity.run {
AdmissionsDto(
id = this.id,
name = this.name,
mainType = this.mainType.toJsonValue(),
postType = this.postType.toJsonValue(),
language = LanguageType.makeLowercase(this.language),
description = this.description,
createdAt = this.createdAt,
modifiedAt = this.modifiedAt
createdAt = this.createdAt!!,
modifiedAt = this.modifiedAt!!
)
}
}
Expand Down

0 comments on commit 62d3556

Please sign in to comment.