continue reborn :(
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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.*
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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()) }
|
||||
}
|
||||
|
||||
@@ -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>(
|
||||
|
||||
@@ -27,7 +27,7 @@ class ReadClientRolesStorage<T : Role>(
|
||||
buildStandardUrl(
|
||||
userRolesFullUrl,
|
||||
usersRolesGetSubjectsPathPart,
|
||||
usersRolesRoleQueryParameterName to unifiedRequester.encodeUrlQueryValue(serializer, role)
|
||||
usersRolesRoleQueryParameterName to role
|
||||
)
|
||||
).body()
|
||||
|
||||
|
||||
@@ -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()) }
|
||||
}
|
||||
|
||||
@@ -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() }
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user