feat: JobProcessorを追加

This commit is contained in:
usbharu 2023-12-10 17:58:55 +09:00
parent 0071759ee4
commit 8038232334
3 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,22 @@
package dev.usbharu.hideout.activitypub.service.activity.accept
import dev.usbharu.hideout.activitypub.service.common.APRequestService
import dev.usbharu.hideout.core.external.job.DeliverAcceptJob
import dev.usbharu.hideout.core.external.job.DeliverAcceptJobParam
import dev.usbharu.hideout.core.query.UserQueryService
import dev.usbharu.hideout.core.service.job.JobProcessor
import org.springframework.stereotype.Service
@Service
class APDeliverAcceptJobProcessor(
private val apRequestService: APRequestService,
private val userQueryService: UserQueryService,
private val deliverAcceptJob: DeliverAcceptJob
) :
JobProcessor<DeliverAcceptJobParam, DeliverAcceptJob> {
override suspend fun process(param: DeliverAcceptJobParam) {
apRequestService.apPost(param.inbox, param.accept, userQueryService.findById(param.signer))
}
override fun job(): DeliverAcceptJob = deliverAcceptJob
}

View File

@ -0,0 +1,22 @@
package dev.usbharu.hideout.activitypub.service.activity.reject
import dev.usbharu.hideout.activitypub.service.common.APRequestService
import dev.usbharu.hideout.core.external.job.DeliverRejectJob
import dev.usbharu.hideout.core.external.job.DeliverRejectJobParam
import dev.usbharu.hideout.core.query.UserQueryService
import dev.usbharu.hideout.core.service.job.JobProcessor
import org.springframework.stereotype.Component
@Component
class APDeliverRejectJobProcessor(
private val apRequestService: APRequestService,
private val userQueryService: UserQueryService,
private val deliverRejectJob: DeliverRejectJob
) :
JobProcessor<DeliverRejectJobParam, DeliverRejectJob> {
override suspend fun process(param: DeliverRejectJobParam) {
apRequestService.apPost(param.inbox, param.reject, userQueryService.findById(param.signer))
}
override fun job(): DeliverRejectJob = deliverRejectJob
}

View File

@ -0,0 +1,21 @@
package dev.usbharu.hideout.activitypub.service.activity.undo
import dev.usbharu.hideout.activitypub.service.common.APRequestService
import dev.usbharu.hideout.core.external.job.DeliverUndoJob
import dev.usbharu.hideout.core.external.job.DeliverUndoJobParam
import dev.usbharu.hideout.core.query.UserQueryService
import dev.usbharu.hideout.core.service.job.JobProcessor
import org.springframework.stereotype.Service
@Service
class APDeliverUndoJobProcessor(
private val deliverUndoJob: DeliverUndoJob,
private val apRequestService: APRequestService,
private val userQueryService: UserQueryService
) : JobProcessor<DeliverUndoJobParam, DeliverUndoJob> {
override suspend fun process(param: DeliverUndoJobParam) {
apRequestService.apPost(param.inbox, param.undo, userQueryService.findById(param.signer))
}
override fun job(): DeliverUndoJob = deliverUndoJob
}