mirror of https://github.com/usbharu/Hideout.git
feat: JobProcessorを追加
This commit is contained in:
parent
0071759ee4
commit
8038232334
|
@ -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
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue