replace posts api and rewrite posts contents to be content ids

This commit is contained in:
InsanusMokrassar 2019-11-04 13:33:03 +06:00
parent 033acc818d
commit 3be34a94bc
7 changed files with 15 additions and 18 deletions

View File

@ -1,3 +0,0 @@
package com.insanusmokrassar.postssystem.core.api
interface PostsAPI : ReadPostsAPI, WritePostsAPI

View File

@ -10,7 +10,7 @@ interface Content
/**
* Content which is already registered in database. Using its [id] you can retrieve all known
* [com.insanusmokrassar.postssystem.core.post.RegisteredPost]s by using
* [com.insanusmokrassar.postssystem.core.api.ReadPostsAPI.getPostsByContent]
* [com.insanusmokrassar.postssystem.core.post.api.ReadPostsAPI.getPostsByContent]
*/
interface RegisteredContent : Content {
val id: ContentId

View File

@ -1,29 +1,26 @@
package com.insanusmokrassar.postssystem.core.post
import com.insanusmokrassar.postssystem.core.content.Content
import com.insanusmokrassar.postssystem.core.content.RegisteredContent
import kotlinx.serialization.Serializable
import com.insanusmokrassar.postssystem.core.content.*
import org.joda.time.DateTime
typealias PostId = String
typealias PostContents = List<Content>
typealias RegisteredPostContents = List<RegisteredContent>
typealias ContentIds = List<ContentId>
/**
* Base interface for creating of new post. Usually, it is just [SimplePost] instance
*/
interface Post {
val content: PostContents
val content: ContentIds
}
/**
* Root entity of whole system. Can be retrieved from [com.insanusmokrassar.postssystem.core.api.ReadPostsAPI] by
* getting and created in [com.insanusmokrassar.postssystem.core.api.WritePostsAPI] by inserting of [Post] instance
* Root entity of whole system. Can be retrieved from [com.insanusmokrassar.postssystem.core.post.api.ReadPostsAPI] by
* getting and created in [com.insanusmokrassar.postssystem.core.post.api.WritePostsAPI] by inserting of [Post] instance
*/
interface RegisteredPost : Post {
val id: PostId
override val content: RegisteredPostContents
override val content: ContentIds
val creationDate: DateTime
val modificationDate: DateTime
@ -34,7 +31,7 @@ interface RegisteredPost : Post {
* is [Post] too, but it is not direct [Post] realisation
*/
data class SimplePost(
override val content: PostContents
override val content: ContentIds
) : Post
/**
@ -42,7 +39,7 @@ data class SimplePost(
*/
data class SimpleRegisteredPost(
override val id: PostId,
override val content: RegisteredPostContents,
override val content: ContentIds,
override val creationDate: DateTime,
override val modificationDate: DateTime = creationDate
) : RegisteredPost

View File

@ -0,0 +1,3 @@
package com.insanusmokrassar.postssystem.core.post.api
interface PostsAPI : ReadPostsAPI, WritePostsAPI

View File

@ -1,4 +1,4 @@
package com.insanusmokrassar.postssystem.core.api
package com.insanusmokrassar.postssystem.core.post.api
import com.insanusmokrassar.postssystem.core.content.ContentId
import com.insanusmokrassar.postssystem.core.post.*

View File

@ -1,4 +1,4 @@
package com.insanusmokrassar.postssystem.core.api
package com.insanusmokrassar.postssystem.core.post.api
import com.insanusmokrassar.postssystem.core.post.*
import com.insanusmokrassar.postssystem.core.post.*

View File

@ -1,4 +1,4 @@
package com.insanusmokrassar.postssystem.core.api
package com.insanusmokrassar.postssystem.core.post.api
import com.insanusmokrassar.postssystem.core.content.ContentId
import com.insanusmokrassar.postssystem.core.content.RegisteredContent