mirror of https://github.com/usbharu/Hideout.git
Merge pull request #7 from usbharu/feature/refactor-ap-model
refactor: AP関係のモデルを移動
This commit is contained in:
commit
8355df70cb
|
@ -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.*
|
||||||
|
|
||||||
|
|
|
@ -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(
|
|
@ -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()
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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(),
|
|
@ -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
|
||||||
|
|
|
@ -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>)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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{
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue