-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#53): converted archive dto v1 classes java to kotlin
- Loading branch information
1 parent
1bd1cee
commit be8d521
Showing
13 changed files
with
149 additions
and
197 deletions.
There are no files selected for viewing
13 changes: 0 additions & 13 deletions
13
archive-application/src/main/java/site/archive/dto/v1/archive/ArchiveCountResponseDtoV1.java
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
archive-application/src/main/java/site/archive/dto/v1/archive/ArchiveCountResponseDtoV1.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package site.archive.dto.v1.archive | ||
|
||
data class ArchiveCountResponseDtoV1(val count: Long) |
98 changes: 0 additions & 98 deletions
98
archive-application/src/main/java/site/archive/dto/v1/archive/ArchiveDtoV1.java
This file was deleted.
Oops, something went wrong.
87 changes: 87 additions & 0 deletions
87
archive-application/src/main/java/site/archive/dto/v1/archive/ArchiveDtoV1.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package site.archive.dto.v1.archive | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude | ||
import site.archive.common.yymmddFormatter | ||
import site.archive.domain.archive.Archive | ||
import site.archive.domain.archive.CoverImageType | ||
import site.archive.domain.archive.Emotion | ||
import site.archive.domain.user.BaseUser | ||
import java.time.LocalDate | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
data class ArchiveDtoV1( | ||
val archiveId: Long, | ||
val name: String, | ||
val watchedOn: String, | ||
val emotion: Emotion, | ||
val mainImage: String, | ||
val authorId: Long, | ||
val isPublic: Boolean? = null, | ||
val coverImageType: CoverImageType? = null, | ||
var companions: List<String>? = null, | ||
var images: List<ArchiveImageDtoV1>? = null | ||
) { | ||
|
||
fun toEntity(user: BaseUser): Archive { | ||
val archivePublic = isPublic ?: false | ||
val archiveCoverImageType = coverImageType ?: CoverImageType.EMOTION_COVER | ||
return Archive.builder() | ||
.name(name) | ||
.watchedOn(LocalDate.parse(watchedOn, yymmddFormatter)) | ||
.emotion(emotion) | ||
.mainImage(mainImage) | ||
.companions(companions) | ||
.author(user) | ||
.isPublic(archivePublic) | ||
.coverImageType(archiveCoverImageType) | ||
.build() | ||
} | ||
|
||
companion object { | ||
/** | ||
* 아카이브 상세 조회 DTO V1 | ||
* 아카이브 연결 이미지들을 다 포함 | ||
* | ||
* @param archive Archive Entity | ||
* @return ArchiveDtoV1 archive specific DTO | ||
*/ | ||
@JvmStatic | ||
fun specificForm(archive: Archive): ArchiveDtoV1 { | ||
val archiveImages = archive.archiveImages.map(ArchiveImageDtoV1::from).toList() | ||
return ArchiveDtoV1( | ||
archiveId = archive.id, | ||
name = archive.name, | ||
watchedOn = archive.watchedOn.format(yymmddFormatter), | ||
emotion = archive.emotion, | ||
mainImage = archive.mainImage, | ||
companions = archive.companions, | ||
images = archiveImages, | ||
authorId = archive.author.id, | ||
isPublic = archive.isPublic | ||
) | ||
} | ||
|
||
/** | ||
* 아카이브 리스트 조회 DTO | ||
* 아카이브 연결 이미지들을 포함하고 있지 않음 | ||
* | ||
* @param archive archive entity | ||
* @return ArchiveDtoV1 archive simple DTO | ||
*/ | ||
@JvmStatic | ||
fun simpleForm(archive: Archive): ArchiveDtoV1 { | ||
return ArchiveDtoV1( | ||
archiveId = archive.id, | ||
name = archive.name, | ||
watchedOn = archive.watchedOn.format(yymmddFormatter), | ||
emotion = archive.emotion, | ||
companions = archive.companions, | ||
mainImage = archive.mainImage, | ||
authorId = archive.author.id, | ||
isPublic = archive.isPublic, | ||
coverImageType = archive.coverImageType | ||
) | ||
} | ||
} | ||
|
||
} |
34 changes: 0 additions & 34 deletions
34
archive-application/src/main/java/site/archive/dto/v1/archive/ArchiveImageDtoV1.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
archive-application/src/main/java/site/archive/dto/v1/archive/ArchiveImageDtoV1.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package site.archive.dto.v1.archive | ||
|
||
import site.archive.domain.archive.Archive | ||
import site.archive.domain.archive.ArchiveImage | ||
|
||
data class ArchiveImageDtoV1( | ||
val archiveImageId: Long, | ||
val image: String, | ||
val review: String, | ||
val backgroundColor: String | ||
) { | ||
|
||
fun toEntity(archive: Archive): ArchiveImage { | ||
return ArchiveImage(image, review, backgroundColor, archive) | ||
} | ||
|
||
companion object { | ||
@JvmStatic | ||
fun from(archiveImage: ArchiveImage): ArchiveImageDtoV1 { | ||
return ArchiveImageDtoV1( | ||
archiveImageId = archiveImage.id, | ||
image = archiveImage.image, | ||
review = archiveImage.review, | ||
backgroundColor = archiveImage.backgroundColor | ||
) | ||
} | ||
} | ||
|
||
} |
12 changes: 0 additions & 12 deletions
12
...e-application/src/main/java/site/archive/dto/v1/archive/ArchiveImageUrlResponseDtoV1.java
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
...ive-application/src/main/java/site/archive/dto/v1/archive/ArchiveImageUrlResponseDtoV1.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package site.archive.dto.v1.archive | ||
|
||
data class ArchiveImageUrlResponseDtoV1(val imageUrl: String) |
22 changes: 0 additions & 22 deletions
22
archive-application/src/main/java/site/archive/dto/v1/archive/ArchiveListResponseDtoV1.java
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
archive-application/src/main/java/site/archive/dto/v1/archive/ArchiveListResponseDtoV1.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package site.archive.dto.v1.archive | ||
|
||
data class ArchiveListResponseDtoV1( | ||
val archiveCount: Int, | ||
val archives: List<ArchiveDtoV1> | ||
) { | ||
|
||
private constructor(archives: List<ArchiveDtoV1>) : this(archives.size, archives) | ||
|
||
companion object { | ||
@JvmStatic | ||
fun from(archiveDtoV1s: List<ArchiveDtoV1>): ArchiveListResponseDtoV1 { | ||
return ArchiveListResponseDtoV1(archiveDtoV1s) | ||
} | ||
} | ||
|
||
} |
12 changes: 0 additions & 12 deletions
12
...ve-application/src/main/java/site/archive/dto/v1/archive/EmailDuplicateResponseDtoV1.java
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
archive-application/src/main/java/site/archive/dto/v1/archive/EmailDuplicateResponseDtoV1.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package site.archive.dto.v1.archive | ||
|
||
data class EmailDuplicateResponseDtoV1(val isDuplicatedEmail: Boolean) |
Oops, something went wrong.