Merge pull request #7 from usbharu/feature/refactor-ap-model

refactor: AP関係のモデルを移動
This commit is contained in:
usbharu 2023-04-14 15:54:45 +09:00 committed by GitHub
commit 8355df70cb
19 changed files with 33 additions and 36 deletions

View File

@ -1,6 +1,6 @@
package dev.usbharu.hideout.domain.model package dev.usbharu.hideout.domain.model
import dev.usbharu.hideout.ap.JsonLd import dev.usbharu.hideout.domain.model.ap.JsonLd
import dev.usbharu.hideout.util.HttpUtil.Activity import dev.usbharu.hideout.util.HttpUtil.Activity
import io.ktor.http.* import io.ktor.http.*

View File

@ -1,7 +1,7 @@
package dev.usbharu.hideout.ap package dev.usbharu.hideout.domain.model.ap
open class Accept : Object { open class Accept : Object {
public var `object`:Object? = null public var `object`: Object? = null
public var actor:String? = null public var actor:String? = null
protected constructor() : super() protected constructor() : super()
constructor( constructor(

View File

@ -1,6 +1,6 @@
package dev.usbharu.hideout.ap package dev.usbharu.hideout.domain.model.ap
open class Follow : Object{ open class Follow : Object {
public var `object`:String? = null public var `object`:String? = null
public var actor:String? = null public var actor:String? = null
protected constructor() : super() protected constructor() : super()

View File

@ -1,4 +1,4 @@
package dev.usbharu.hideout.ap package dev.usbharu.hideout.domain.model.ap
open class Image : Object { open class Image : Object {
private var mediaType: String? = null private var mediaType: String? = null

View File

@ -1,10 +1,9 @@
package dev.usbharu.hideout.ap package dev.usbharu.hideout.domain.model.ap
import com.fasterxml.jackson.annotation.JsonAutoDetect import com.fasterxml.jackson.annotation.JsonAutoDetect
import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.core.TreeNode
import com.fasterxml.jackson.databind.JsonDeserializer import com.fasterxml.jackson.databind.JsonDeserializer
import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.JsonSerializer import com.fasterxml.jackson.databind.JsonSerializer

View File

@ -1,6 +1,6 @@
package dev.usbharu.hideout.ap package dev.usbharu.hideout.domain.model.ap
open class Key : Object{ open class Key : Object {
var id:String? = null var id:String? = null
var owner:String? = null var owner:String? = null
var publicKeyPem:String? = null var publicKeyPem:String? = null

View File

@ -1,4 +1,4 @@
package dev.usbharu.hideout.ap package dev.usbharu.hideout.domain.model.ap
import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.databind.JsonSerializer import com.fasterxml.jackson.databind.JsonSerializer

View File

@ -1,4 +1,4 @@
package dev.usbharu.hideout.ap package dev.usbharu.hideout.domain.model.ap
open class Person : Object { open class Person : Object {
private var id:String? = null private var id:String? = null
@ -7,8 +7,8 @@ open class Person : Object {
var inbox:String? = null var inbox:String? = null
var outbox:String? = null var outbox:String? = null
private var url:String? = null private var url:String? = null
private var icon:Image? = null private var icon: Image? = null
var publicKey:Key? = null var publicKey: Key? = null
protected constructor() : super() protected constructor() : super()
constructor( constructor(
type: List<String> = emptyList(), type: List<String> = emptyList(),

View File

@ -1,6 +1,6 @@
package dev.usbharu.hideout.plugins package dev.usbharu.hideout.plugins
import dev.usbharu.hideout.ap.JsonLd import dev.usbharu.hideout.domain.model.ap.JsonLd
import dev.usbharu.hideout.config.Config import dev.usbharu.hideout.config.Config
import dev.usbharu.hideout.service.IUserAuthService import dev.usbharu.hideout.service.IUserAuthService
import dev.usbharu.hideout.service.impl.UserAuthService import dev.usbharu.hideout.service.impl.UserAuthService

View File

@ -1,11 +1,11 @@
package dev.usbharu.hideout.service.activitypub package dev.usbharu.hideout.service.activitypub
import dev.usbharu.hideout.ap.Follow import dev.usbharu.hideout.domain.model.ap.Follow
import dev.usbharu.hideout.domain.model.ActivityPubResponse import dev.usbharu.hideout.domain.model.ActivityPubResponse
import dev.usbharu.hideout.domain.model.job.ReceiveFollowJob import dev.usbharu.hideout.domain.model.job.ReceiveFollowJob
import kjob.core.job.JobProps import kjob.core.job.JobProps
interface ActivityPubFollowService { interface ActivityPubFollowService {
suspend fun receiveFollow(follow:Follow):ActivityPubResponse suspend fun receiveFollow(follow: Follow):ActivityPubResponse
suspend fun receiveFollowJob(props: JobProps<ReceiveFollowJob>) suspend fun receiveFollowJob(props: JobProps<ReceiveFollowJob>)
} }

View File

@ -1,8 +1,8 @@
package dev.usbharu.hideout.service.activitypub package dev.usbharu.hideout.service.activitypub
import com.fasterxml.jackson.module.kotlin.readValue import com.fasterxml.jackson.module.kotlin.readValue
import dev.usbharu.hideout.ap.Accept import dev.usbharu.hideout.domain.model.ap.Accept
import dev.usbharu.hideout.ap.Follow import dev.usbharu.hideout.domain.model.ap.Follow
import dev.usbharu.hideout.config.Config import dev.usbharu.hideout.config.Config
import dev.usbharu.hideout.domain.model.ActivityPubResponse import dev.usbharu.hideout.domain.model.ActivityPubResponse
import dev.usbharu.hideout.domain.model.ActivityPubStringResponse import dev.usbharu.hideout.domain.model.ActivityPubStringResponse

View File

@ -1,18 +1,15 @@
package dev.usbharu.hideout.service.activitypub package dev.usbharu.hideout.service.activitypub
import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.JsonNode
import dev.usbharu.hideout.ap.Follow import dev.usbharu.hideout.domain.model.ap.Follow
import dev.usbharu.hideout.config.Config import dev.usbharu.hideout.config.Config
import dev.usbharu.hideout.domain.model.ActivityPubResponse import dev.usbharu.hideout.domain.model.ActivityPubResponse
import dev.usbharu.hideout.domain.model.job.HideoutJob import dev.usbharu.hideout.domain.model.job.HideoutJob
import dev.usbharu.hideout.domain.model.job.ReceiveFollowJob import dev.usbharu.hideout.domain.model.job.ReceiveFollowJob
import dev.usbharu.hideout.exception.JsonParseException import dev.usbharu.hideout.exception.JsonParseException
import kjob.core.Job
import kjob.core.dsl.JobContextWithProps import kjob.core.dsl.JobContextWithProps
import kjob.core.job.JobProps import kjob.core.job.JobProps
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import kotlin.reflect.full.createInstance
import kotlin.reflect.full.primaryConstructor
class ActivityPubServiceImpl(private val activityPubFollowService: ActivityPubFollowService) : ActivityPubService { class ActivityPubServiceImpl(private val activityPubFollowService: ActivityPubFollowService) : ActivityPubService {

View File

@ -1,9 +1,9 @@
package dev.usbharu.hideout.service.activitypub package dev.usbharu.hideout.service.activitypub
import dev.usbharu.hideout.ap.Person import dev.usbharu.hideout.domain.model.ap.Person
interface ActivityPubUserService { interface ActivityPubUserService {
suspend fun getPersonByName(name:String):Person suspend fun getPersonByName(name:String): Person
suspend fun fetchPerson(url:String):Person suspend fun fetchPerson(url:String): Person
} }

View File

@ -1,9 +1,9 @@
package dev.usbharu.hideout.service.activitypub package dev.usbharu.hideout.service.activitypub
import com.fasterxml.jackson.module.kotlin.readValue import com.fasterxml.jackson.module.kotlin.readValue
import dev.usbharu.hideout.ap.Image import dev.usbharu.hideout.domain.model.ap.Image
import dev.usbharu.hideout.ap.Key import dev.usbharu.hideout.domain.model.ap.Key
import dev.usbharu.hideout.ap.Person import dev.usbharu.hideout.domain.model.ap.Person
import dev.usbharu.hideout.config.Config import dev.usbharu.hideout.config.Config
import dev.usbharu.hideout.domain.model.User import dev.usbharu.hideout.domain.model.User
import dev.usbharu.hideout.domain.model.UserAuthentication import dev.usbharu.hideout.domain.model.UserAuthentication

View File

@ -3,7 +3,7 @@ package dev.usbharu.hideout.ap
import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue import com.fasterxml.jackson.module.kotlin.readValue
import org.junit.jupiter.api.Assertions.* import dev.usbharu.hideout.domain.model.ap.Follow
class ContextDeserializerTest { class ContextDeserializerTest {

View File

@ -1,7 +1,8 @@
package dev.usbharu.hideout.ap package dev.usbharu.hideout.ap
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import org.junit.jupiter.api.Assertions.* import dev.usbharu.hideout.domain.model.ap.Accept
import dev.usbharu.hideout.domain.model.ap.Follow
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class ContextSerializerTest{ class ContextSerializerTest{

View File

@ -1,6 +1,6 @@
package dev.usbharu.hideout.plugins package dev.usbharu.hideout.plugins
import dev.usbharu.hideout.ap.JsonLd import dev.usbharu.hideout.domain.model.ap.JsonLd
import dev.usbharu.hideout.domain.model.User import dev.usbharu.hideout.domain.model.User
import dev.usbharu.hideout.domain.model.UserAuthentication import dev.usbharu.hideout.domain.model.UserAuthentication
import dev.usbharu.hideout.domain.model.UserAuthenticationEntity import dev.usbharu.hideout.domain.model.UserAuthenticationEntity

View File

@ -6,9 +6,9 @@ import com.fasterxml.jackson.annotation.Nulls
import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue import com.fasterxml.jackson.module.kotlin.readValue
import dev.usbharu.hideout.ap.Image import dev.usbharu.hideout.domain.model.ap.Image
import dev.usbharu.hideout.ap.Key import dev.usbharu.hideout.domain.model.ap.Key
import dev.usbharu.hideout.ap.Person import dev.usbharu.hideout.domain.model.ap.Person
import dev.usbharu.hideout.plugins.configureRouting import dev.usbharu.hideout.plugins.configureRouting
import dev.usbharu.hideout.plugins.configureSerialization import dev.usbharu.hideout.plugins.configureSerialization
import dev.usbharu.hideout.service.activitypub.ActivityPubService import dev.usbharu.hideout.service.activitypub.ActivityPubService

View File

@ -4,10 +4,10 @@
package dev.usbharu.hideout.service.activitypub package dev.usbharu.hideout.service.activitypub
import com.fasterxml.jackson.module.kotlin.readValue import com.fasterxml.jackson.module.kotlin.readValue
import dev.usbharu.hideout.ap.*
import dev.usbharu.hideout.config.Config import dev.usbharu.hideout.config.Config
import dev.usbharu.hideout.config.ConfigData import dev.usbharu.hideout.config.ConfigData
import dev.usbharu.hideout.domain.model.UserEntity import dev.usbharu.hideout.domain.model.UserEntity
import dev.usbharu.hideout.domain.model.ap.*
import dev.usbharu.hideout.domain.model.job.ReceiveFollowJob import dev.usbharu.hideout.domain.model.job.ReceiveFollowJob
import dev.usbharu.hideout.service.impl.UserService import dev.usbharu.hideout.service.impl.UserService
import dev.usbharu.hideout.service.job.JobQueueParentService import dev.usbharu.hideout.service.job.JobQueueParentService