From e864d942c149149f18f26581e635bc038efbd178 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Fri, 21 Apr 2023 00:14:17 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20DI=E3=81=AB=E7=99=BB=E9=8C=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/dev/usbharu/hideout/Application.kt | 17 +++++++---------- .../hideout/repository/PostRepositoryImpl.kt | 1 + 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/Application.kt b/src/main/kotlin/dev/usbharu/hideout/Application.kt index bd2d6774..5b2a1acb 100644 --- a/src/main/kotlin/dev/usbharu/hideout/Application.kt +++ b/src/main/kotlin/dev/usbharu/hideout/Application.kt @@ -25,11 +25,6 @@ import io.ktor.client.* import io.ktor.client.engine.cio.* import io.ktor.client.plugins.logging.* import io.ktor.server.application.* -import kjob.core.Job -import kjob.core.KJob -import kjob.core.dsl.JobContextWithProps -import kjob.core.dsl.JobRegisterContext -import kjob.core.dsl.KJobFunctions import kjob.core.kjob import org.jetbrains.exposed.sql.Database import org.koin.ktor.ext.inject @@ -76,15 +71,16 @@ fun Application.parent() { logger = Logger.DEFAULT level = LogLevel.ALL } - install(httpSignaturePlugin){ + install(httpSignaturePlugin) { keyMap = KtorKeyMap(get()) } } } - single { ActivityPubFollowServiceImpl(get(), get(), get(),get()) } - single { ActivityPubServiceImpl(get()) } + single { ActivityPubFollowServiceImpl(get(), get(), get(), get()) } + single { ActivityPubServiceImpl(get(), get()) } single { UserService(get()) } single { ActivityPubUserServiceImpl(get(), get(), get()) } + single { ActivityPubNoteServiceImpl(get(), get(), get()) } } @@ -101,6 +97,7 @@ fun Application.parent() { inject().value ) } + @Suppress("unused") fun Application.worker() { val kJob = kjob(ExposedKJob) { @@ -109,9 +106,9 @@ fun Application.worker() { val activityPubService = inject().value - kJob.register(ReceiveFollowJob){ + kJob.register(ReceiveFollowJob) { execute { - activityPubService.processActivity(this,it) + activityPubService.processActivity(this, it) } } } diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/PostRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/repository/PostRepositoryImpl.kt index 7ec43b22..34ec97ae 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/PostRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/repository/PostRepositoryImpl.kt @@ -39,6 +39,7 @@ class PostRepositoryImpl(database: Database, private val idGenerateService: IdGe } return@query PostEntity( generateId, + post.userId, post.overview, post.text, post.createdAt,