X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FReply.kt;h=d570f48d09810a71bf5b5977d4668204cd6eba86;hb=549af4fa7323c58e0660f21dd8605cbc812db286;hp=cfc940a20946faf38619f0fb42ccc3f2ee9fa938;hpb=5c5bee980f9cab5792e34d1c9840f73b8b191830;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/data/Reply.kt b/src/main/kotlin/net/pterodactylus/sone/data/Reply.kt index cfc940a..d570f48 100644 --- a/src/main/kotlin/net/pterodactylus/sone/data/Reply.kt +++ b/src/main/kotlin/net/pterodactylus/sone/data/Reply.kt @@ -17,6 +17,7 @@ package net.pterodactylus.sone.data +import net.pterodactylus.sone.database.PostReplyBuilder import java.util.Comparator.comparing /** @@ -32,3 +33,13 @@ val newestReplyFirst: Comparator> = */ val noFutureReply: (Reply<*>) -> Boolean = { it.getTime() <= System.currentTimeMillis() } + +data class PostReplyShell(val id: String, val soneId: String, val postId: String, val time: Long, val text: String) { + + fun build(postReplyBuilder: PostReplyBuilder): PostReply { + return postReplyBuilder.withId(id).from(soneId).to(postId).withTime(time).withText(text).build() + } + +} + +fun PostReply.toShell() = PostReplyShell(id, sone.id, postId, time, text)