Merge pull request #5 from PostsSystem/features/instruct_for_add_new_conten

Описана процедура добавления контента
This commit is contained in:
InsanusMokrassar 2021-12-05 19:50:21 +06:00 committed by GitHub
commit 5a1f69e01c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 1 deletions

View File

@ -8,7 +8,7 @@
* Client - часть с клиентским кодом. В большинстве своём включает работу с сервером, MVVM часть (View при этом должны
находиться в платформенной части, если их нельзя вынести в сommon часть клиента)
* Client - итоговый клиент. На момент написания этой доки (`Пн окт 25 12:56:41 +06 2021`) предполагается два варианта:
* Мультиплатформенный проект со сборкой каждого таргета. Скорее всего, не будет использован в силу сложности настройки
* Мультиплатформенный проект со сборкой каждого таргета. Скорее всего, не будет использован в силу сложности настройки
части клиентов (например, андроид)
* Мультимодульный проект
* Server - пока что JVM-only модуль, включающий все необходимые для сервера фичи

View File

@ -0,0 +1,33 @@
## How to create content?
For example, you want to create content named "MyFormat". To do this, you must perform the following actions:
1. Copy "template" folder from "core/features" in "core/features/content"
2. Rename this folder in "myformat"
3. Inside the "myformat" folder rename all the "template" on "content.myformat"
4. In the "settings.gradle" file in the "includes" array add the following code:
```kotlin
":features:content:myformat:common",
":features:content:myformat:client",
":features:content:myformat:server",
```
5. In the "core/features/content/myformat/common/src" folder create folders with appropriate subfolders "commonMain/kotlin/dev/inmo/postssystem/features/content/myformat/common":
6. In the last folder "сommon", create a data class and the configurator as shown below:
```kotlin
@Serializable
data class MyFormatContent(
// Your code
) : Content
```
```kotlin
object MyFormatContentSerializerModuleConfigurator : ContentSerializersModuleConfigurator.Element {
override fun PolymorphicModuleBuilder<Content>.invoke() {
subclass(MyFormatContent::class, MyFormatContent.serializer())
}
}
```
7. In two "di.kt" file located in "core/client/src/commonMain/kotlin/dev/inmo/postsystem/client" and "core/server/src/main/java/dev/inmo/postsystem/client" respectively add the following string:
```kotlin
singleWithRandomQualifier<ContentSerializersModuleConfigurator.Element> { MyFormatContentSerializerModuleConfigurator }
```