-
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.
Persistent id is UUID, not Long (#59)
- Loading branch information
Showing
67 changed files
with
1,076 additions
and
723 deletions.
There are no files selected for viewing
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
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
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
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
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
4 changes: 3 additions & 1 deletion
4
persistence/src/main/kotlin/com/github/jactor/persistence/dto/PersistentData.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
3 changes: 2 additions & 1 deletion
3
persistence/src/main/kotlin/com/github/jactor/persistence/dto/PersistentDto.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
21 changes: 21 additions & 0 deletions
21
persistence/src/main/kotlin/com/github/jactor/persistence/entity/AddressBuilder.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,21 @@ | ||
package com.github.jactor.persistence.entity | ||
|
||
import java.util.UUID | ||
import com.github.jactor.persistence.dto.AddressInternalDto | ||
|
||
internal object AddressBuilder { | ||
fun new(addressInternalDto: AddressInternalDto) = AddressData( | ||
addressInternalDto = addressInternalDto.copy( | ||
persistentDto = addressInternalDto.persistentDto.copy(id = UUID.randomUUID()) | ||
) | ||
) | ||
|
||
fun unchanged(addressInternalDto: AddressInternalDto): AddressData = AddressData( | ||
addressInternalDto = addressInternalDto | ||
) | ||
|
||
@JvmRecord | ||
data class AddressData(val addressInternalDto: AddressInternalDto) { | ||
fun build(): AddressEntity = AddressEntity(addressInternalDto = addressInternalDto) | ||
} | ||
} |
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
39 changes: 39 additions & 0 deletions
39
persistence/src/main/kotlin/com/github/jactor/persistence/entity/BlogBuilder.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,39 @@ | ||
package com.github.jactor.persistence.entity | ||
|
||
import java.util.UUID | ||
import com.github.jactor.persistence.dto.BlogDto | ||
import com.github.jactor.persistence.dto.BlogEntryDto | ||
import com.github.jactor.persistence.dto.PersistentDto | ||
|
||
internal object BlogBuilder { | ||
fun new(blogDto: BlogDto = BlogDto()): BlogData = BlogData( | ||
blogDto = blogDto.copy(persistentDto = blogDto.persistentDto.copy(id = UUID.randomUUID())) | ||
) | ||
|
||
fun unchanged(blogDto: BlogDto = BlogDto()): BlogData = BlogData( | ||
blogDto = blogDto | ||
) | ||
|
||
@JvmRecord | ||
data class BlogData( | ||
val blogDto: BlogDto, | ||
val blogEntryDto: BlogEntryDto? = null, | ||
) { | ||
fun withEntry(blogEntryDto: BlogEntryDto): BlogData = copy( | ||
blogEntryDto = blogEntryDto.copy( | ||
persistentDto = PersistentDto(id = UUID.randomUUID()), | ||
blog = blogDto, | ||
) | ||
) | ||
|
||
fun withUnchangedEntry(blogEntryDto: BlogEntryDto): BlogData = copy( | ||
blogEntryDto = blogEntryDto, | ||
) | ||
|
||
fun buildBlogEntity(): BlogEntity = BlogEntity(blogDto = blogDto) | ||
|
||
fun buildBlogEntryEntity(): BlogEntryEntity = BlogEntryEntity( | ||
blogEntryDto = blogEntryDto ?: error("No blog entry dto"), | ||
) | ||
} | ||
} |
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
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
Oops, something went wrong.