From 5fadd58079454952b8a21989ddce6fbcc1992793 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:38:38 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=83=96=E3=82=AD=E3=83=A5?= =?UTF-8?q?=E3=83=BC=E3=81=A8=E3=82=BF=E3=82=A4=E3=83=A0=E3=83=A9=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E6=A7=8B=E7=AF=89=E3=81=AB=E4=BD=BF=E3=81=86DB?= =?UTF-8?q?=E3=82=92=E9=81=B8=E6=8A=9E=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hideout/repository/MongoTimelineRepositoryWrapper.kt | 2 ++ .../hideout/service/job/KJobMongoJobQueueWorkerService.kt | 2 +- .../hideout/service/job/KjobMongoJobQueueParentService.kt | 2 +- .../hideout/service/post/MongoGenerateTimelineService.kt | 2 ++ src/main/resources/application.yml | 3 +-- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/MongoTimelineRepositoryWrapper.kt b/src/main/kotlin/dev/usbharu/hideout/repository/MongoTimelineRepositoryWrapper.kt index a3e31b6f..3b2abb73 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/MongoTimelineRepositoryWrapper.kt +++ b/src/main/kotlin/dev/usbharu/hideout/repository/MongoTimelineRepositoryWrapper.kt @@ -4,10 +4,12 @@ import dev.usbharu.hideout.domain.model.hideout.entity.Timeline import dev.usbharu.hideout.service.core.IdGenerateService import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.stereotype.Repository @Repository @Suppress("InjectDispatcher") +@ConditionalOnProperty("hideout.use-mongodb", havingValue = "", matchIfMissing = false) class MongoTimelineRepositoryWrapper( private val mongoTimelineRepository: MongoTimelineRepository, private val idGenerateService: IdGenerateService diff --git a/src/main/kotlin/dev/usbharu/hideout/service/job/KJobMongoJobQueueWorkerService.kt b/src/main/kotlin/dev/usbharu/hideout/service/job/KJobMongoJobQueueWorkerService.kt index b0f13ab2..78ddff9f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/job/KJobMongoJobQueueWorkerService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/job/KJobMongoJobQueueWorkerService.kt @@ -10,7 +10,7 @@ import dev.usbharu.hideout.domain.model.job.HideoutJob as HJ import kjob.core.dsl.JobContextWithProps as JCWP @Service -@ConditionalOnProperty(name = ["hideout.job-queue.type"], havingValue = "nosql") +@ConditionalOnProperty(name = ["hideout.use-mongodb"], havingValue = "", matchIfMissing = false) class KJobMongoJobQueueWorkerService : JobQueueWorkerService { val kjob by lazy { kjob(Mongo) { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/job/KjobMongoJobQueueParentService.kt b/src/main/kotlin/dev/usbharu/hideout/service/job/KjobMongoJobQueueParentService.kt index c532d2e2..46f0b1c4 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/job/KjobMongoJobQueueParentService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/job/KjobMongoJobQueueParentService.kt @@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.stereotype.Service @Service -@ConditionalOnProperty(name = ["hideout.job-queue.type"], havingValue = "nosql") +@ConditionalOnProperty(name = ["hideout.use-mongodb"], havingValue = "", matchIfMissing = false) class KjobMongoJobQueueParentService : JobQueueParentService { private val kjob = kjob(Mongo) { connectionString = "mongodb://localhost" diff --git a/src/main/kotlin/dev/usbharu/hideout/service/post/MongoGenerateTimelineService.kt b/src/main/kotlin/dev/usbharu/hideout/service/post/MongoGenerateTimelineService.kt index fa5c9800..f918f960 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/post/MongoGenerateTimelineService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/post/MongoGenerateTimelineService.kt @@ -3,12 +3,14 @@ package dev.usbharu.hideout.service.post import dev.usbharu.hideout.domain.mastodon.model.generated.Status import dev.usbharu.hideout.domain.model.hideout.entity.Timeline import dev.usbharu.hideout.query.mastodon.StatusQueryService +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.data.mongodb.core.MongoTemplate import org.springframework.data.mongodb.core.query.Criteria import org.springframework.data.mongodb.core.query.Query import org.springframework.stereotype.Service @Service +@ConditionalOnProperty("hideout.use-mongodb", havingValue = "", matchIfMissing = false) class MongoGenerateTimelineService( private val statusQueryService: StatusQueryService, private val mongoTemplate: MongoTemplate diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index bcf7e661..0c4a32a1 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,7 +1,6 @@ hideout: url: "https://test-hideout.usbharu.dev" - job-queue: - type: "nosql" + use-mongodb: true security: jwt: generate: true