continue reborn :(

This commit is contained in:
InsanusMokrassar 2024-08-26 23:58:53 +06:00
parent e98a484c4d
commit 546736690c
26 changed files with 65 additions and 53 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.idea
.kotlin
out/*
*.iml
target

View File

@ -3,6 +3,7 @@ plugins {
id "org.jetbrains.kotlin.plugin.serialization"
id "com.android.library"
alias(libs.plugins.compose)
alias(libs.plugins.kt.jb.compose)
}
apply from: "$mppProjectWithSerializationPresetPath"

View File

@ -58,5 +58,6 @@
"semver": "^7.3.2",
"svgo": "^2.8.0",
"watch-run": "^1.2.5"
}
},
"packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"
}

View File

@ -6,6 +6,7 @@ android {
defaultConfig {
minSdkVersion libs.versions.android.props.minSdk.get().toInteger()
compileSdkVersion libs.versions.android.props.compileSdk.get().toInteger()
targetSdkVersion libs.versions.android.props.compileSdk.get().toInteger()
versionCode "${android_code_version}".toInteger()
versionName "$version"

View File

@ -3,6 +3,7 @@ plugins {
id "org.jetbrains.kotlin.plugin.serialization"
id "com.android.library"
alias(libs.plugins.compose)
alias(libs.plugins.kt.jb.compose)
}
apply from: "$mppProjectWithSerializationPresetPath"

View File

@ -3,6 +3,7 @@ plugins {
id "org.jetbrains.kotlin.plugin.serialization"
id "com.android.library"
alias(libs.plugins.compose)
alias(libs.plugins.kt.jb.compose)
}
apply from: "$mppProjectWithSerializationPresetPath"

View File

@ -1,6 +1,7 @@
package dev.inmo.postssystem.features.common.common
import dev.inmo.micro_utils.common.MPPFile
import dev.inmo.micro_utils.common.filesize
import io.ktor.utils.io.core.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.builtins.ByteArraySerializer
@ -27,9 +28,18 @@ class BytesBasedInputProvider(
}
}
@Serializable(SimpleInputProviderSerializer::class)
expect class FileBasedInputProvider : SimpleInputProvider {
internal interface FileInputProvider : SimpleInputProvider {
val file: MPPFile
override val contentBytes: Long?
get() = file.filesize
}
@Serializable(SimpleInputProviderSerializer::class)
expect class FileBasedInputProvider : FileInputProvider {
override val file: MPPFile
override fun invoke(): Input
}
@Serializable(SimpleInputProviderSerializer::class)

View File

@ -7,12 +7,9 @@ import kotlinx.serialization.Serializable
@Serializable(SimpleInputProviderSerializer::class)
actual class FileBasedInputProvider internal constructor(
actual val file: MPPFile
) : SimpleInputProvider {
override val contentBytes: Long
get() = file.filesize
override fun invoke(): Input = error("Files inputs must not be used directly")
actual override val file: MPPFile
) : FileInputProvider {
actual override fun invoke(): Input = error("Files inputs must not be used directly")
}
fun MPPFile.inputProvider() = FileBasedInputProvider(this)

View File

@ -8,10 +8,8 @@ import kotlinx.serialization.Serializable
@Serializable(SimpleInputProviderSerializer::class)
actual class FileBasedInputProvider(
actual val file: MPPFile
) : SimpleInputProvider {
override val contentBytes: Long?
get() = file.filesize
actual override val file: MPPFile
) : FileInputProvider {
override fun invoke(): Input = file.inputStream().asInput()
actual override fun invoke(): Input = file.inputStream().asInput()
}

View File

@ -3,6 +3,7 @@ plugins {
id "org.jetbrains.kotlin.plugin.serialization"
id "com.android.library"
alias(libs.plugins.compose)
alias(libs.plugins.kt.jb.compose)
}
apply from: "$mppProjectWithSerializationPresetPath"

View File

@ -6,7 +6,6 @@ import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions
import dev.inmo.micro_utils.mime_types.KnownMimeTypes
import dev.inmo.micro_utils.pagination.*
import dev.inmo.micro_utils.repos.*
import dev.inmo.postssystem.features.common.common.FileBasedInputProvider
import dev.inmo.postssystem.features.content.common.*
import dev.inmo.postssystem.features.content.server.storage.ServerContentStorage
import dev.inmo.postssystem.features.files.common.*

View File

@ -3,6 +3,7 @@ plugins {
id "org.jetbrains.kotlin.plugin.serialization"
id "com.android.library"
alias(libs.plugins.compose)
alias(libs.plugins.kt.jb.compose)
}
apply from: "$mppProjectWithSerializationPresetPath"

View File

@ -3,6 +3,7 @@ plugins {
id "org.jetbrains.kotlin.plugin.serialization"
id "com.android.library"
alias(libs.plugins.compose)
alias(libs.plugins.kt.jb.compose)
}
apply from: "$mppProjectWithSerializationPresetPath"

View File

@ -5,5 +5,5 @@ import dev.inmo.postssystem.features.auth.client.AuthorizedQualifiers
import dev.inmo.postssystem.features.files.common.storage.ReadFilesStorage
val loader = AuthorizedModuleLoader {
single<ReadFilesStorage> { ClientReadFilesStorage(get(AuthorizedQualifiers.ServerUrlQualifier), get(), get()) }
single<ReadFilesStorage> { ClientReadFilesStorage(get(AuthorizedQualifiers.ServerUrlQualifier), get(), get(), get()) }
}

View File

@ -1,7 +1,7 @@
package dev.inmo.postssystem.features.roles.client
import dev.inmo.postssystem.features.roles.common.*
import dev.inmo.micro_utils.ktor.client.UnifiedRequester
import io.ktor.client.*
import kotlinx.serialization.KSerializer
class ClientRolesStorage<T : Role>(

View File

@ -27,7 +27,7 @@ class ReadClientRolesStorage<T : Role>(
buildStandardUrl(
userRolesFullUrl,
usersRolesGetSubjectsPathPart,
usersRolesRoleQueryParameterName to unifiedRequester.encodeUrlQueryValue(serializer, role)
usersRolesRoleQueryParameterName to role
)
).body()

View File

@ -5,5 +5,5 @@ import dev.inmo.postssystem.features.auth.client.AuthorizedQualifiers
import dev.inmo.postssystem.features.users.common.ReadUsersStorage
val loader = AuthorizedModuleLoader {
single<ReadUsersStorage> { UsersStorageKtorClient(get(AuthorizedQualifiers.ServerUrlQualifier), get()) }
single<ReadUsersStorage> { UsersStorageKtorClient(get(AuthorizedQualifiers.ServerUrlQualifier), get(), get()) }
}

View File

@ -1,19 +1,19 @@
package dev.inmo.postssystem.features.users.client
import dev.inmo.postssystem.features.users.common.*
import dev.inmo.micro_utils.ktor.client.UnifiedRequester
import dev.inmo.micro_utils.ktor.common.buildStandardUrl
import dev.inmo.micro_utils.repos.ReadCRUDRepo
import dev.inmo.micro_utils.repos.ktor.client.crud.KtorReadStandardCrudRepo
import kotlinx.serialization.builtins.nullable
import dev.inmo.micro_utils.repos.ktor.client.crud.KtorReadCRUDRepoClient
import io.ktor.client.*
import io.ktor.http.*
class UsersStorageKtorClient(
baseUrl: String,
client: HttpClient
) : ReadUsersStorage, ReadCRUDRepo<User, UserId> by KtorReadStandardCrudRepo(
client: HttpClient,
contentType: ContentType
) : ReadUsersStorage, ReadCRUDRepo<User, UserId> by KtorReadCRUDRepoClient(
buildStandardUrl(baseUrl, usersServerPathPart),
client,
User.serializer(),
User.serializer().nullable,
UserId.serializer()
contentType,
{ it.long.toString() }
)

View File

@ -30,7 +30,7 @@ class ExposedUsersStorage(override val database: Database) : UsersStorage, Abstr
initTable()
}
override fun insert(value: NewUser, it: InsertStatement<Number>) {
override fun insert(value: NewUser, it: UpdateBuilder<Int>) {
it[usernameColumn] = value.username.string
it[firstNameColumn] = value.firstName
it[lastNameColumn] = value.lastName

View File

@ -1,21 +1,21 @@
[versions]
kotlin = "1.9.22"
kotlin-serialization = "1.6.2"
kotlin-coroutines = "1.7.3"
jsuikit = "0.7.4"
compose = "1.5.12"
microutils = "0.20.34"
tgbotapi = "10.0.1"
ktor = "2.3.8"
korlibs = "5.3.1"
koin = "3.5.3"
exposed = "0.47.0"
kotlin = "2.0.10"
kotlin-serialization = "1.7.1"
kotlin-coroutines = "1.8.1"
jsuikit = "0.7.6"
compose = "1.7.0-alpha02"
microutils = "0.22.0"
tgbotapi = "17.0.0"
ktor = "2.3.11"
korlibs = "5.4.0"
koin = "3.5.6"
exposed = "0.53.0"
psql = "42.3.6"
scrimage = "4.1.1"
dokka = "1.9.10"
dokka = "1.9.20"
logback = "1.2.10"
uuid = "0.8.2"
uuid = "0.8.4"
android-junit = "4.12"
android-test-junit = "1.1.2"
@ -35,8 +35,8 @@ android-espresso = "3.3.0"
android-test = "1.1.2"
android-props-minSdk = "21"
android-props-compileSdk = "34"
android-props-buildTools = "34.0.0"
android-props-compileSdk = "35"
android-props-buildTools = "35.0.0"
[libraries]
@ -113,3 +113,4 @@ buildscript-android-dexcount = { module = "com.getkeepsafe.dexcount:dexcount-gra
[plugins]
compose = { id = "org.jetbrains.compose", version.ref = "compose" }
kt-jb-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }

View File

@ -1,4 +1,4 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME

View File

@ -26,7 +26,6 @@ kotlin {
jsTest {
dependencies {
implementation kotlin('test-js')
implementation kotlin('test-junit')
}
}
}

View File

@ -46,7 +46,6 @@ kotlin {
jsTest {
dependencies {
implementation kotlin('test-js')
implementation kotlin('test-junit')
}
}
androidUnitTest {

View File

@ -1,11 +1,13 @@
package dev.inmo.postssystem.publicators.simple.client
import dev.inmo.micro_utils.ktor.client.UnifiedRequester
import dev.inmo.micro_utils.ktor.common.buildStandardUrl
import dev.inmo.postssystem.features.posts.common.PostId
import dev.inmo.postssystem.features.publication.common.publicatorsRootPath
import dev.inmo.postssystem.publicators.simple.common.simplePublicatorPublishPathPart
import dev.inmo.postssystem.publicators.simple.common.simplePublicatorRootPath
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.request.*
import kotlinx.serialization.builtins.serializer
class SimplePublicatorServiceClient(
@ -25,9 +27,9 @@ class SimplePublicatorServiceClient(
simplePublicatorPublishPathPart
)
override suspend fun publish(postId: PostId) = unifiedRequester.unipost(
override suspend fun publish(postId: PostId) = client.post(
publishFullUrl,
PostId.serializer() to postId,
Unit.serializer()
)
) {
setBody(postId)
}.body<Unit>()
}

View File

@ -8,7 +8,6 @@ import dev.inmo.micro_utils.ktor.common.encodeHex
import dev.inmo.micro_utils.repos.ktor.common.crud.createRouting
import dev.inmo.micro_utils.repos.ktor.common.crud.updateRouting
import dev.inmo.micro_utils.repos.ktor.common.one_to_many.removeRoute
import dev.inmo.postssystem.features.common.common.FileBasedInputProvider
import dev.inmo.postssystem.features.common.common.SimpleInputProvider
import dev.inmo.postssystem.features.content.common.*
import dev.inmo.postssystem.features.files.common.FileId

View File

@ -11,7 +11,6 @@ import dev.inmo.micro_utils.repos.ktor.common.crud.createRouting
import dev.inmo.micro_utils.repos.ktor.common.crud.updateRouting
import dev.inmo.micro_utils.repos.ktor.common.one_to_many.removeRoute
import dev.inmo.micro_utils.repos.ktor.server.crud.configureReadCRUDRepoRoutes
import dev.inmo.postssystem.features.common.common.FileBasedInputProvider
import dev.inmo.postssystem.features.content.common.*
import dev.inmo.postssystem.features.files.common.FileId
import dev.inmo.postssystem.features.posts.common.*