full reborn

This commit is contained in:
2021-11-24 13:52:27 +06:00
parent 0ac6b0a4df
commit 6a6a197041
246 changed files with 4327 additions and 6952 deletions
.github/workflows
LICENSEREADME.mdbuild.gradle
business_cases/post_creating
client
build.gradle
src
commonMain
kotlin
dev
inmo
postssystem
business_cases
post_creating
main
common
src
commonMain
kotlin
dev
inmo
postssystem
main
server
build.gradle
src
jvmMain
kotlin
dev
inmo
postssystem
business_cases
post_creating
client
core
defaultAndroidSettingsdefaultAndroidSettings.gradleextensions.gradle
features
auth
common
client
build.gradle
src
commonMain
kotlin
dev
inmo
main
common
build.gradle
src
commonMain
kotlin
dev
inmo
jvmMain
kotlin
dev
inmo
postssystem
features
main
server
build.gradle
src
jvmMain
kotlin
dev
inmo
postssystem
features
files
client
build.gradle
src
commonMain
kotlin
dev
inmo
postssystem
features
main
common
server
build.gradle
src
jvmMain
kotlin
dev
inmo
postssystem
features
roles
status
client
build.gradle
src
commonMain
kotlin
dev
inmo
postssystem
features
main
common
build.gradle
src
commonMain
kotlin
dev
inmo
postssystem
features
status
main
server
build.gradle
src
jvmMain
kotlin
dev
inmo
postssystem
features
template
users
client
build.gradle
src
commonMain
kotlin
dev
inmo
postssystem
features
main
common
build.gradle
src
commonMain
kotlin
dev
inmo
postssystem
jvmMain
kotlin
dev
inmo
postssystem
features
main
server
build.gradle
src
jvmMain
kotlin
dev
inmo
postssystem
gradle.properties
gradle/wrapper
gradlewgradlew.bat
mimes_generator
mppAndroidProject.gradlemppJavaProject.gradlemppJsProject.gradlemppProjectWithSerialization.gradlepubconf.kpsbpublish.gradlepublish.kpsb
publishing
server
settings.gradle

@ -0,0 +1,20 @@
plugins {
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization"
id "com.android.library"
}
apply from: "$mppProjectWithSerializationPresetPath"
kotlin {
sourceSets {
commonMain {
dependencies {
api project(":postssystem.features.common.common")
api "dev.inmo:micro_utils.repos.ktor.client:$microutils_version"
api "io.ktor:ktor-client-auth:$ktor_version"
api "io.ktor:ktor-client-logging:$ktor_version"
}
}
}
}

@ -0,0 +1,7 @@
package dev.inmo.postssystem.features.common.common
import kotlinx.coroutines.flow.MutableStateFlow
inline fun <T> DefaultMVVMStateFlow(
state: T
) = MutableStateFlow<T>(state)

@ -0,0 +1,15 @@
package dev.inmo.postssystem.features.common.common
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
interface UIModel<StateType> {
val currentState: StateFlow<StateType>
}
abstract class AbstractUIModel<StateType>(
initState: StateType
) : UIModel<StateType> {
protected val _currentState = DefaultMVVMStateFlow(initState)
override val currentState: StateFlow<StateType> = _currentState.asStateFlow()
}

@ -0,0 +1,4 @@
package dev.inmo.postssystem.features.common.common
interface UIView {
}

@ -0,0 +1,15 @@
package dev.inmo.postssystem.features.common.common
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
interface UIViewModel<StateType> {
val currentState: StateFlow<StateType>
}
abstract class AbstractUIViewModel<StateType> : UIViewModel<StateType> {
protected val _currentState = DefaultMVVMStateFlow(initState())
override val currentState: StateFlow<StateType> = _currentState.asStateFlow()
abstract fun initState(): StateType
}

@ -0,0 +1 @@
<manifest package="dev.inmo.postssystem.features.common.client"/>

@ -0,0 +1,30 @@
plugins {
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization"
id "com.android.library"
}
apply from: "$mppProjectWithSerializationPresetPath"
kotlin {
sourceSets {
commonMain {
dependencies {
api "dev.inmo:micro_utils.common:$microutils_version"
api "dev.inmo:micro_utils.serialization.typed_serializer:$microutils_version"
api "io.insert-koin:koin-core:$koin_version"
api "com.benasher44:uuid:$uuid_version"
}
}
jvmMain {
dependencies {
api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
}
}
androidMain {
dependencies {
api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
}
}
}
}

@ -0,0 +1,11 @@
package dev.inmo.postssystem.features.common.common
import kotlinx.serialization.json.Json
val DefaultJson = Json {
ignoreUnknownKeys = true
}
val Json.default
get() = DefaultJson

@ -0,0 +1,5 @@
package dev.inmo.postssystem.features.common.common
import org.koin.core.scope.Scope
inline fun <reified T : Any> Scope.getAllDistinct() = getAll<T>().distinct()

@ -0,0 +1,3 @@
package dev.inmo.postssystem.features.common.common
typealias Milliseconds = Long

@ -0,0 +1,16 @@
package dev.inmo.postssystem.features.common.common
import org.koin.core.definition.Definition
import org.koin.core.instance.InstanceFactory
import org.koin.core.module.Module
import org.koin.core.qualifier.Qualifier
import org.koin.dsl.binds
import kotlin.reflect.full.allSuperclasses
inline fun <reified T : Any> Module.singleWithBinds(
qualifier: Qualifier? = null,
createdAtStart: Boolean = false,
noinline definition: Definition<T>
): Pair<Module, InstanceFactory<*>> {
return single(qualifier, createdAtStart, definition) binds (T::class.allSuperclasses.toTypedArray())
}

@ -0,0 +1 @@
<manifest package="dev.inmo.postssystem.features.common.common"/>

@ -0,0 +1,25 @@
plugins {
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization"
}
apply from: "$mppJavaProjectPresetPath"
kotlin {
sourceSets {
commonMain {
dependencies {
api project(":postssystem.features.common.common")
api "dev.inmo:micro_utils.repos.exposed:$microutils_version"
api "dev.inmo:micro_utils.repos.ktor.server:$microutils_version"
api "dev.inmo:micro_utils.ktor.server:$microutils_version"
}
}
jvmMain {
dependencies {
api "io.ktor:ktor-auth:$ktor_version"
api "ch.qos.logback:logback-classic:$logback_version"
}
}
}
}

@ -0,0 +1,18 @@
package dev.inmo.postssystem.features.common.server.sessions
import dev.inmo.micro_utils.ktor.server.configurators.KtorApplicationConfigurator
import io.ktor.application.Application
import io.ktor.auth.Authentication
import io.ktor.auth.authentication
class ApplicationAuthenticationConfigurator(
private val elements: List<Element>
) : KtorApplicationConfigurator {
fun interface Element { operator fun Authentication.Configuration.invoke() }
override fun Application.configure() {
authentication {
elements.forEach { it.apply { invoke() } }
}
}
}