add post preview
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package dev.inmo.postssystem.features.posts.common
|
||||
|
||||
import com.soywiz.klock.DateTime
|
||||
import dev.inmo.postssystem.features.common.common.DateTimeSerializer
|
||||
import dev.inmo.postssystem.features.content.common.ContentId
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.jvm.JvmInline
|
||||
|
||||
/**
|
||||
* Identifier of [RegisteredPost] in system
|
||||
*/
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class PostId(val long: Long) {
|
||||
override fun toString(): String = long.toString()
|
||||
}
|
||||
typealias ContentIds = List<ContentId>
|
||||
|
||||
/**
|
||||
* Base interface for creating of new post
|
||||
*
|
||||
* @see NewPost
|
||||
* @see RegisteredPost
|
||||
*/
|
||||
@Serializable
|
||||
sealed class Post {
|
||||
abstract val content: ContentIds
|
||||
}
|
||||
|
||||
/**
|
||||
* This type of [Post] should be used in case you wish to register new post in system
|
||||
*/
|
||||
@Serializable
|
||||
data class NewPost(
|
||||
override val content: ContentIds
|
||||
) : Post()
|
||||
|
||||
/**
|
||||
* Registered [Post]
|
||||
*/
|
||||
@Serializable
|
||||
data class RegisteredPost(
|
||||
val id: PostId,
|
||||
override val content: ContentIds,
|
||||
@Serializable(DateTimeSerializer::class)
|
||||
val creationDate: DateTime
|
||||
) : Post()
|
1
features/posts/common/src/main/AndroidManifest.xml
Normal file
1
features/posts/common/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1 @@
|
||||
<manifest package="dev.inmo.postssystem.features.posts.common"/>
|
Reference in New Issue
Block a user