From 9fb4a2aae63b4b93afe64da81ecceac2418ca22a Mon Sep 17 00:00:00 2001
From: InsanusMokrassar <ovsyannikov.alexey95@gmail.com>
Date: Fri, 20 Sep 2019 13:05:14 +0600
Subject: [PATCH] fill readonly PostsAPI

---
 .../postssystem/core/api/PostsAPI.kt                 | 12 ++++++++++++
 .../postssystem/core/{ => post}/Post.kt              |  4 +++-
 .../postssystem/core/post/PostMetaInfo.kt            |  9 +++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 src/main/kotlin/com/github/insanusmokrassar/postssystem/core/api/PostsAPI.kt
 rename src/main/kotlin/com/github/insanusmokrassar/postssystem/core/{ => post}/Post.kt (65%)
 create mode 100644 src/main/kotlin/com/github/insanusmokrassar/postssystem/core/post/PostMetaInfo.kt

diff --git a/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/api/PostsAPI.kt b/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/api/PostsAPI.kt
new file mode 100644
index 00000000..d46b15dd
--- /dev/null
+++ b/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/api/PostsAPI.kt
@@ -0,0 +1,12 @@
+package com.github.insanusmokrassar.postssystem.core.api
+
+import com.github.insanusmokrassar.postssystem.core.post.Post
+import com.github.insanusmokrassar.postssystem.core.post.PostId
+import com.github.insanusmokrassar.postssystem.core.content.ContentId
+import org.joda.time.DateTime
+
+interface PostsAPI {
+    suspend fun getPostById(id: PostId): Post?
+    suspend fun getPostsByContent(id: ContentId): List<Post>
+    suspend fun getPostsByDates(from: DateTime? = null, to: DateTime? = null): List<Post>
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/Post.kt b/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/post/Post.kt
similarity index 65%
rename from src/main/kotlin/com/github/insanusmokrassar/postssystem/core/Post.kt
rename to src/main/kotlin/com/github/insanusmokrassar/postssystem/core/post/Post.kt
index 11ddd6a3..08a0e98f 100644
--- a/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/Post.kt
+++ b/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/post/Post.kt
@@ -1,4 +1,4 @@
-package com.github.insanusmokrassar.postssystem.core
+package com.github.insanusmokrassar.postssystem.core.post
 
 import com.github.insanusmokrassar.postssystem.core.content.Content
 
@@ -7,4 +7,6 @@ typealias PostId = String
 interface Post {
     val id: PostId
     val content: List<Content>
+
+    val meta: PostMetaInfo
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/post/PostMetaInfo.kt b/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/post/PostMetaInfo.kt
new file mode 100644
index 00000000..345951a9
--- /dev/null
+++ b/src/main/kotlin/com/github/insanusmokrassar/postssystem/core/post/PostMetaInfo.kt
@@ -0,0 +1,9 @@
+package com.github.insanusmokrassar.postssystem.core.post
+
+import org.joda.time.DateTime
+
+interface PostMetaInfo {
+    val postId: PostId
+    val creationDate: DateTime
+    val modificationDate: DateTime
+}
\ No newline at end of file