diff --git a/build.gradle.kts b/build.gradle.kts index 34f81ca1..20fec36a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -66,7 +66,7 @@ tasks.create("openApiGenerateMastodonCompatibleApi", GenerateTask: typeMappings.put("org.springframework.core.io.Resource", "org.springframework.web.multipart.MultipartFile") schemaMappings.put( "StatusesRequest", - "dev.usbharu.hideout.domain.model.mastodon.StatusesRequest" + "dev.usbharu.hideout.mastodon.interfaces.api.status.StatusesRequest" ) templateDir.set("$rootDir/templates") } diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/ap/FailedToGetActivityPubResourceException.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/exception/FailedToGetActivityPubResourceException.kt similarity index 67% rename from src/main/kotlin/dev/usbharu/hideout/exception/ap/FailedToGetActivityPubResourceException.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/exception/FailedToGetActivityPubResourceException.kt index 73670af5..e050e716 100644 --- a/src/main/kotlin/dev/usbharu/hideout/exception/ap/FailedToGetActivityPubResourceException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/exception/FailedToGetActivityPubResourceException.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.exception.ap +package dev.usbharu.hideout.activitypub.domain.exception -import dev.usbharu.hideout.exception.FailedToGetResourcesException +import dev.usbharu.hideout.core.domain.exception.FailedToGetResourcesException class FailedToGetActivityPubResourceException : FailedToGetResourcesException { constructor() : super() diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/ap/IllegalActivityPubObjectException.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/exception/IllegalActivityPubObjectException.kt similarity index 87% rename from src/main/kotlin/dev/usbharu/hideout/exception/ap/IllegalActivityPubObjectException.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/exception/IllegalActivityPubObjectException.kt index 7e63dbc4..11300baa 100644 --- a/src/main/kotlin/dev/usbharu/hideout/exception/ap/IllegalActivityPubObjectException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/exception/IllegalActivityPubObjectException.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.exception.ap +package dev.usbharu.hideout.activitypub.domain.exception import java.io.Serial diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/JsonParseException.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/exception/JsonParseException.kt similarity index 87% rename from src/main/kotlin/dev/usbharu/hideout/exception/JsonParseException.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/exception/JsonParseException.kt index e822367d..318c512a 100644 --- a/src/main/kotlin/dev/usbharu/hideout/exception/JsonParseException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/exception/JsonParseException.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.exception +package dev.usbharu.hideout.activitypub.domain.exception import java.io.Serial diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Accept.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Accept.kt similarity index 82% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Accept.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Accept.kt index e25d0e6d..c6187d2a 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Accept.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Accept.kt @@ -1,6 +1,8 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object +import dev.usbharu.hideout.activitypub.domain.model.`object`.ObjectDeserializer open class Accept : Object { @JsonDeserialize(using = ObjectDeserializer::class) diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Create.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Create.kt similarity index 86% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Create.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Create.kt index 5e9da1df..8a11bd74 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Create.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Create.kt @@ -1,6 +1,8 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object +import dev.usbharu.hideout.activitypub.domain.model.`object`.ObjectDeserializer open class Create : Object { @JsonDeserialize(using = ObjectDeserializer::class) diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Document.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Document.kt similarity index 89% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Document.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Document.kt index 0dacaf00..07fd34e9 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Document.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Document.kt @@ -1,4 +1,6 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model + +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object open class Document : Object { diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Emoji.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Emoji.kt similarity index 89% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Emoji.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Emoji.kt index 35806687..5f0c888f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Emoji.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Emoji.kt @@ -1,4 +1,6 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model + +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object open class Emoji : Object { var updated: String? = null diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Follow.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Follow.kt similarity index 87% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Follow.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Follow.kt index d15d7631..a4af7bbc 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Follow.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Follow.kt @@ -1,4 +1,6 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model + +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object open class Follow : Object { var `object`: String? = null diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Image.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Image.kt similarity index 87% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Image.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Image.kt index a53c6b99..09ddc19c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Image.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Image.kt @@ -1,4 +1,6 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model + +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object open class Image : Object { private var mediaType: String? = null diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/JsonLd.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/JsonLd.kt similarity index 97% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/JsonLd.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/JsonLd.kt index 193b3f60..a369e036 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/JsonLd.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/JsonLd.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model import com.fasterxml.jackson.annotation.JsonAutoDetect import com.fasterxml.jackson.annotation.JsonCreator diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Key.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Key.kt similarity index 89% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Key.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Key.kt index b5fd3529..5e182260 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Key.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Key.kt @@ -1,4 +1,6 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model + +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object open class Key : Object { var owner: String? = null diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Like.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Like.kt similarity index 87% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Like.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Like.kt index 625a83ef..6a6dc039 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Like.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Like.kt @@ -1,6 +1,8 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object +import dev.usbharu.hideout.activitypub.domain.model.`object`.ObjectDeserializer open class Like : Object { var `object`: String? = null diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Note.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Note.kt similarity index 95% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Note.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Note.kt index 0375b673..46d395aa 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Note.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Note.kt @@ -1,4 +1,6 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model + +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object open class Note : Object { var attributedTo: String? = null diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Person.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Person.kt similarity index 95% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Person.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Person.kt index e7625b44..afe87fb9 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Person.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Person.kt @@ -1,4 +1,6 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model + +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object open class Person : Object { var preferredUsername: String? = null diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Undo.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Undo.kt similarity index 85% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Undo.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Undo.kt index 8a175f22..83841e8f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Undo.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Undo.kt @@ -1,6 +1,8 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object +import dev.usbharu.hideout.activitypub.domain.model.`object`.ObjectDeserializer import java.time.Instant open class Undo : Object { diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/wellknown/Nodeinfo.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/nodeinfo/Nodeinfo.kt similarity index 68% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/wellknown/Nodeinfo.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/nodeinfo/Nodeinfo.kt index 7335d12a..7db0894f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/wellknown/Nodeinfo.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/nodeinfo/Nodeinfo.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.wellknown +package dev.usbharu.hideout.activitypub.domain.model.nodeinfo data class Nodeinfo( val links: List diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/wellknown/Nodeinfo2_0.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/nodeinfo/Nodeinfo2_0.kt similarity index 94% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/wellknown/Nodeinfo2_0.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/nodeinfo/Nodeinfo2_0.kt index b4faa8a4..c84e4dcc 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/wellknown/Nodeinfo2_0.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/nodeinfo/Nodeinfo2_0.kt @@ -1,6 +1,6 @@ @file:Suppress("ClassName") -package dev.usbharu.hideout.domain.model.wellknown +package dev.usbharu.hideout.activitypub.domain.model.nodeinfo @Suppress("ClassNaming") data class Nodeinfo2_0( diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Object.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/object/Object.kt similarity index 94% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Object.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/object/Object.kt index 482ef329..cc37e451 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Object.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/object/Object.kt @@ -1,9 +1,10 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model.`object` import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.databind.JsonSerializer import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonSerialize +import dev.usbharu.hideout.activitypub.domain.model.JsonLd open class Object : JsonLd { @JsonSerialize(using = TypeSerializer::class) diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/ObjectDeserializer.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/object/ObjectDeserializer.kt similarity index 96% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/ObjectDeserializer.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/object/ObjectDeserializer.kt index c6a330c2..accfc214 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/ObjectDeserializer.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/object/ObjectDeserializer.kt @@ -1,10 +1,11 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model.`object` import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.databind.DeserializationContext import com.fasterxml.jackson.databind.JsonDeserializer import com.fasterxml.jackson.databind.JsonNode -import dev.usbharu.hideout.service.ap.ExtendedActivityVocabulary +import dev.usbharu.hideout.activitypub.domain.model.* +import dev.usbharu.hideout.activitypub.service.common.ExtendedActivityVocabulary class ObjectDeserializer : JsonDeserializer() { @Suppress("LongMethod", "CyclomaticComplexMethod") diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/ObjectValue.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/object/ObjectValue.kt similarity index 92% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ap/ObjectValue.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/object/ObjectValue.kt index 635d560d..c4f8225b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/ObjectValue.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/object/ObjectValue.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.ap +package dev.usbharu.hideout.activitypub.domain.model.`object` open class ObjectValue : Object { diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/wellknown/WebFinger.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/webfinger/WebFinger.kt similarity index 69% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/wellknown/WebFinger.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/webfinger/WebFinger.kt index 01f0e645..939df427 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/wellknown/WebFinger.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/webfinger/WebFinger.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.wellknown +package dev.usbharu.hideout.activitypub.domain.model.webfinger data class WebFinger(val subject: String, val links: List) { data class Link(val rel: String, val type: String, val href: String) diff --git a/src/main/kotlin/dev/usbharu/hideout/query/activitypub/NoteQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/NoteQueryServiceImpl.kt similarity index 75% rename from src/main/kotlin/dev/usbharu/hideout/query/activitypub/NoteQueryServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/NoteQueryServiceImpl.kt index 55746226..460acf89 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/activitypub/NoteQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/NoteQueryServiceImpl.kt @@ -1,11 +1,14 @@ -package dev.usbharu.hideout.query.activitypub +package dev.usbharu.hideout.activitypub.infrastructure.exposedquery -import dev.usbharu.hideout.domain.model.ap.Document -import dev.usbharu.hideout.domain.model.ap.Note -import dev.usbharu.hideout.domain.model.hideout.entity.Post -import dev.usbharu.hideout.domain.model.hideout.entity.Visibility -import dev.usbharu.hideout.repository.* -import dev.usbharu.hideout.service.ap.APNoteServiceImpl.Companion.public +import dev.usbharu.hideout.activitypub.domain.model.Document +import dev.usbharu.hideout.activitypub.domain.model.Note +import dev.usbharu.hideout.activitypub.query.NoteQueryService +import dev.usbharu.hideout.activitypub.service.`object`.note.APNoteServiceImpl.Companion.public +import dev.usbharu.hideout.application.infrastructure.exposed.QueryMapper +import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.domain.model.post.PostRepository +import dev.usbharu.hideout.core.domain.model.post.Visibility +import dev.usbharu.hideout.core.infrastructure.exposedrepository.* import org.jetbrains.exposed.sql.Query import org.jetbrains.exposed.sql.ResultRow import org.jetbrains.exposed.sql.select @@ -24,7 +27,7 @@ class NoteQueryServiceImpl(private val postRepository: PostRepository, private v .let { it.toNote() to postQueryMapper.map(it).first() } } - private suspend fun ResultRow.toNote(mediaList: List): Note { + private suspend fun ResultRow.toNote(mediaList: List): Note { val replyId = this[Posts.replyId] val replyTo = if (replyId != null) { postRepository.findById(replyId).url diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/UserAPController.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/actor/UserAPController.kt similarity index 77% rename from src/main/kotlin/dev/usbharu/hideout/controller/UserAPController.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/actor/UserAPController.kt index 5390fff2..1bf3954c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/UserAPController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/actor/UserAPController.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.controller +package dev.usbharu.hideout.activitypub.interfaces.api.actor -import dev.usbharu.hideout.domain.model.ap.Person +import dev.usbharu.hideout.activitypub.domain.model.Person import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PathVariable diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/UserAPControllerImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/actor/UserAPControllerImpl.kt similarity index 73% rename from src/main/kotlin/dev/usbharu/hideout/controller/UserAPControllerImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/actor/UserAPControllerImpl.kt index fe485244..2a83a418 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/UserAPControllerImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/actor/UserAPControllerImpl.kt @@ -1,7 +1,7 @@ -package dev.usbharu.hideout.controller +package dev.usbharu.hideout.activitypub.interfaces.api.actor -import dev.usbharu.hideout.domain.model.ap.Person -import dev.usbharu.hideout.service.ap.APUserService +import dev.usbharu.hideout.activitypub.domain.model.Person +import dev.usbharu.hideout.activitypub.service.`object`.user.APUserService import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.RestController diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ActivityPubStringResponse.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/common/ActivityPubStringResponse.kt similarity index 94% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/ActivityPubStringResponse.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/common/ActivityPubStringResponse.kt index b0a546d9..60a18526 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ActivityPubStringResponse.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/common/ActivityPubStringResponse.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.domain.model +package dev.usbharu.hideout.activitypub.interfaces.api.common -import dev.usbharu.hideout.domain.model.ap.JsonLd +import dev.usbharu.hideout.activitypub.domain.model.JsonLd import dev.usbharu.hideout.util.HttpUtil.Activity import io.ktor.http.* diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/wellknown/HostMetaController.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/hostmeta/HostMetaController.kt similarity index 90% rename from src/main/kotlin/dev/usbharu/hideout/controller/wellknown/HostMetaController.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/hostmeta/HostMetaController.kt index c035eb84..90c5e245 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/wellknown/HostMetaController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/hostmeta/HostMetaController.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.controller.wellknown +package dev.usbharu.hideout.activitypub.interfaces.api.hostmeta -import dev.usbharu.hideout.config.ApplicationConfig +import dev.usbharu.hideout.application.config.ApplicationConfig import org.intellij.lang.annotations.Language import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/InboxController.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/inbox/InboxController.kt similarity index 92% rename from src/main/kotlin/dev/usbharu/hideout/controller/InboxController.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/inbox/InboxController.kt index 826e8597..e8f2a764 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/InboxController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/inbox/InboxController.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.controller +package dev.usbharu.hideout.activitypub.interfaces.api.inbox import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/InboxControllerImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/inbox/InboxControllerImpl.kt similarity index 90% rename from src/main/kotlin/dev/usbharu/hideout/controller/InboxControllerImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/inbox/InboxControllerImpl.kt index e06ec648..04f1d6f3 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/InboxControllerImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/inbox/InboxControllerImpl.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.controller +package dev.usbharu.hideout.activitypub.interfaces.api.inbox -import dev.usbharu.hideout.service.ap.APService +import dev.usbharu.hideout.activitypub.service.common.APService import org.slf4j.LoggerFactory import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/wellknown/NodeinfoController.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/nodeinfo/NodeinfoController.kt similarity index 89% rename from src/main/kotlin/dev/usbharu/hideout/controller/wellknown/NodeinfoController.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/nodeinfo/NodeinfoController.kt index 5c645da3..3292e5b7 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/wellknown/NodeinfoController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/nodeinfo/NodeinfoController.kt @@ -1,8 +1,8 @@ -package dev.usbharu.hideout.controller.wellknown +package dev.usbharu.hideout.activitypub.interfaces.api.nodeinfo -import dev.usbharu.hideout.config.ApplicationConfig -import dev.usbharu.hideout.domain.model.wellknown.Nodeinfo -import dev.usbharu.hideout.domain.model.wellknown.Nodeinfo2_0 +import dev.usbharu.hideout.activitypub.domain.model.nodeinfo.Nodeinfo +import dev.usbharu.hideout.activitypub.domain.model.nodeinfo.Nodeinfo2_0 +import dev.usbharu.hideout.application.config.ApplicationConfig import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.GetMapping diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/NoteApController.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/note/NoteApController.kt similarity index 82% rename from src/main/kotlin/dev/usbharu/hideout/controller/NoteApController.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/note/NoteApController.kt index f7fe6197..5e284d88 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/NoteApController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/note/NoteApController.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.controller +package dev.usbharu.hideout.activitypub.interfaces.api.note -import dev.usbharu.hideout.domain.model.ap.Note +import dev.usbharu.hideout.activitypub.domain.model.Note import org.springframework.http.ResponseEntity import org.springframework.security.core.annotation.CurrentSecurityContext import org.springframework.security.core.context.SecurityContext diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/NoteApControllerImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/note/NoteApControllerImpl.kt similarity index 80% rename from src/main/kotlin/dev/usbharu/hideout/controller/NoteApControllerImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/note/NoteApControllerImpl.kt index 0c330524..374f9b2c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/NoteApControllerImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/note/NoteApControllerImpl.kt @@ -1,8 +1,8 @@ -package dev.usbharu.hideout.controller +package dev.usbharu.hideout.activitypub.interfaces.api.note -import dev.usbharu.hideout.domain.model.ap.Note -import dev.usbharu.hideout.service.api.NoteApApiService -import dev.usbharu.hideout.service.signature.HttpSignatureUser +import dev.usbharu.hideout.activitypub.domain.model.Note +import dev.usbharu.hideout.activitypub.service.`object`.note.NoteApApiService +import dev.usbharu.hideout.core.infrastructure.springframework.httpsignature.HttpSignatureUser import org.springframework.http.ResponseEntity import org.springframework.security.core.annotation.CurrentSecurityContext import org.springframework.security.core.context.SecurityContext diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/OutboxController.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/outbox/OutboxController.kt similarity index 90% rename from src/main/kotlin/dev/usbharu/hideout/controller/OutboxController.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/outbox/OutboxController.kt index b62e5c11..39cd78f1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/OutboxController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/outbox/OutboxController.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.controller +package dev.usbharu.hideout.activitypub.interfaces.api.outbox import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/OutboxControllerImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/outbox/OutboxControllerImpl.kt similarity index 87% rename from src/main/kotlin/dev/usbharu/hideout/controller/OutboxControllerImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/outbox/OutboxControllerImpl.kt index ba2f6542..398c680f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/OutboxControllerImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/outbox/OutboxControllerImpl.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.controller +package dev.usbharu.hideout.activitypub.interfaces.api.outbox import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/wellknown/WebFingerController.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/webfinger/WebFingerController.kt similarity index 85% rename from src/main/kotlin/dev/usbharu/hideout/controller/wellknown/WebFingerController.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/webfinger/WebFingerController.kt index a8032d1a..c365d161 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/wellknown/WebFingerController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/interfaces/api/webfinger/WebFingerController.kt @@ -1,8 +1,8 @@ -package dev.usbharu.hideout.controller.wellknown +package dev.usbharu.hideout.activitypub.interfaces.api.webfinger -import dev.usbharu.hideout.config.ApplicationConfig -import dev.usbharu.hideout.domain.model.wellknown.WebFinger -import dev.usbharu.hideout.service.api.WebFingerApiService +import dev.usbharu.hideout.activitypub.domain.model.webfinger.WebFinger +import dev.usbharu.hideout.activitypub.service.webfinger.WebFingerApiService +import dev.usbharu.hideout.application.config.ApplicationConfig import dev.usbharu.hideout.util.AcctUtil import kotlinx.coroutines.runBlocking import org.slf4j.LoggerFactory diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/query/NoteQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/query/NoteQueryService.kt new file mode 100644 index 00000000..8c870d84 --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/query/NoteQueryService.kt @@ -0,0 +1,8 @@ +package dev.usbharu.hideout.activitypub.query + +import dev.usbharu.hideout.activitypub.domain.model.Note +import dev.usbharu.hideout.core.domain.model.post.Post + +interface NoteQueryService { + suspend fun findById(id: Long): Pair +} diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APAcceptService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/accept/APAcceptService.kt similarity index 74% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/APAcceptService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/accept/APAcceptService.kt index 8832d8ad..72c3f8c3 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APAcceptService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/accept/APAcceptService.kt @@ -1,14 +1,14 @@ -package dev.usbharu.hideout.service.ap +package dev.usbharu.hideout.activitypub.service.activity.accept -import dev.usbharu.hideout.domain.model.ActivityPubResponse -import dev.usbharu.hideout.domain.model.ActivityPubStringResponse -import dev.usbharu.hideout.domain.model.ap.Accept -import dev.usbharu.hideout.domain.model.ap.Follow -import dev.usbharu.hideout.exception.ap.IllegalActivityPubObjectException -import dev.usbharu.hideout.query.FollowerQueryService -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.service.core.Transaction -import dev.usbharu.hideout.service.user.UserService +import dev.usbharu.hideout.activitypub.domain.exception.IllegalActivityPubObjectException +import dev.usbharu.hideout.activitypub.domain.model.Accept +import dev.usbharu.hideout.activitypub.domain.model.Follow +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubResponse +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubStringResponse +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.query.FollowerQueryService +import dev.usbharu.hideout.core.query.UserQueryService +import dev.usbharu.hideout.core.service.user.UserService import io.ktor.http.* import org.slf4j.LoggerFactory import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APCreateService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/create/APCreateService.kt similarity index 68% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/APCreateService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/create/APCreateService.kt index c4171528..ec073d95 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APCreateService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/create/APCreateService.kt @@ -1,11 +1,12 @@ -package dev.usbharu.hideout.service.ap +package dev.usbharu.hideout.activitypub.service.activity.create -import dev.usbharu.hideout.domain.model.ActivityPubResponse -import dev.usbharu.hideout.domain.model.ActivityPubStringResponse -import dev.usbharu.hideout.domain.model.ap.Create -import dev.usbharu.hideout.domain.model.ap.Note -import dev.usbharu.hideout.exception.ap.IllegalActivityPubObjectException -import dev.usbharu.hideout.service.core.Transaction +import dev.usbharu.hideout.activitypub.domain.exception.IllegalActivityPubObjectException +import dev.usbharu.hideout.activitypub.domain.model.Create +import dev.usbharu.hideout.activitypub.domain.model.Note +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubResponse +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubStringResponse +import dev.usbharu.hideout.activitypub.service.`object`.note.APNoteService +import dev.usbharu.hideout.application.external.Transaction import io.ktor.http.* import org.slf4j.LoggerFactory import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/APReceiveFollowJobService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APReceiveFollowJobService.kt similarity index 52% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/job/APReceiveFollowJobService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APReceiveFollowJobService.kt index 0aa35a9c..2b7a84d4 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/APReceiveFollowJobService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APReceiveFollowJobService.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.service.ap.job +package dev.usbharu.hideout.activitypub.service.activity.follow -import dev.usbharu.hideout.domain.model.job.ReceiveFollowJob +import dev.usbharu.hideout.core.external.job.ReceiveFollowJob import kjob.core.job.JobProps interface APReceiveFollowJobService { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/APReceiveFollowJobServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APReceiveFollowJobServiceImpl.kt similarity index 78% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/job/APReceiveFollowJobServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APReceiveFollowJobServiceImpl.kt index cc12b0b1..b3da9d3c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/APReceiveFollowJobServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APReceiveFollowJobServiceImpl.kt @@ -1,15 +1,15 @@ -package dev.usbharu.hideout.service.ap.job +package dev.usbharu.hideout.activitypub.service.activity.follow import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.readValue -import dev.usbharu.hideout.domain.model.ap.Accept -import dev.usbharu.hideout.domain.model.ap.Follow -import dev.usbharu.hideout.domain.model.job.ReceiveFollowJob -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.service.ap.APRequestService -import dev.usbharu.hideout.service.ap.APUserService -import dev.usbharu.hideout.service.core.Transaction -import dev.usbharu.hideout.service.user.UserService +import dev.usbharu.hideout.activitypub.domain.model.Accept +import dev.usbharu.hideout.activitypub.domain.model.Follow +import dev.usbharu.hideout.activitypub.service.common.APRequestService +import dev.usbharu.hideout.activitypub.service.`object`.user.APUserService +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.external.job.ReceiveFollowJob +import dev.usbharu.hideout.core.query.UserQueryService +import dev.usbharu.hideout.core.service.user.UserService import kjob.core.job.JobProps import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Qualifier diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APReceiveFollowService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APReceiveFollowService.kt similarity index 73% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/APReceiveFollowService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APReceiveFollowService.kt index e53c5130..95b47ad1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APReceiveFollowService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APReceiveFollowService.kt @@ -1,11 +1,11 @@ -package dev.usbharu.hideout.service.ap +package dev.usbharu.hideout.activitypub.service.activity.follow import com.fasterxml.jackson.databind.ObjectMapper -import dev.usbharu.hideout.domain.model.ActivityPubResponse -import dev.usbharu.hideout.domain.model.ActivityPubStringResponse -import dev.usbharu.hideout.domain.model.ap.Follow -import dev.usbharu.hideout.domain.model.job.ReceiveFollowJob -import dev.usbharu.hideout.service.job.JobQueueParentService +import dev.usbharu.hideout.activitypub.domain.model.Follow +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubResponse +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubStringResponse +import dev.usbharu.hideout.core.external.job.ReceiveFollowJob +import dev.usbharu.hideout.core.service.job.JobQueueParentService import io.ktor.http.* import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Qualifier diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APSendFollowService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APSendFollowService.kt similarity index 70% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/APSendFollowService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APSendFollowService.kt index 0bc74d60..e71e7c79 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APSendFollowService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/follow/APSendFollowService.kt @@ -1,7 +1,8 @@ -package dev.usbharu.hideout.service.ap +package dev.usbharu.hideout.activitypub.service.activity.follow -import dev.usbharu.hideout.domain.model.ap.Follow -import dev.usbharu.hideout.domain.model.hideout.dto.SendFollowDto +import dev.usbharu.hideout.activitypub.domain.model.Follow +import dev.usbharu.hideout.activitypub.service.common.APRequestService +import dev.usbharu.hideout.core.service.follow.SendFollowDto import org.springframework.stereotype.Service interface APSendFollowService { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APLikeService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/APLikeService.kt similarity index 72% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/APLikeService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/APLikeService.kt index d7d62fc3..739f4f83 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APLikeService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/APLikeService.kt @@ -1,13 +1,15 @@ -package dev.usbharu.hideout.service.ap +package dev.usbharu.hideout.activitypub.service.activity.like -import dev.usbharu.hideout.domain.model.ActivityPubResponse -import dev.usbharu.hideout.domain.model.ActivityPubStringResponse -import dev.usbharu.hideout.domain.model.ap.Like -import dev.usbharu.hideout.exception.ap.FailedToGetActivityPubResourceException -import dev.usbharu.hideout.exception.ap.IllegalActivityPubObjectException -import dev.usbharu.hideout.query.PostQueryService -import dev.usbharu.hideout.service.core.Transaction -import dev.usbharu.hideout.service.reaction.ReactionService +import dev.usbharu.hideout.activitypub.domain.exception.FailedToGetActivityPubResourceException +import dev.usbharu.hideout.activitypub.domain.exception.IllegalActivityPubObjectException +import dev.usbharu.hideout.activitypub.domain.model.Like +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubResponse +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubStringResponse +import dev.usbharu.hideout.activitypub.service.`object`.note.APNoteService +import dev.usbharu.hideout.activitypub.service.`object`.user.APUserService +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.query.PostQueryService +import dev.usbharu.hideout.core.service.reaction.ReactionService import io.ktor.http.* import org.slf4j.LoggerFactory import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APReactionService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/APReactionService.kt similarity index 80% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/APReactionService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/APReactionService.kt index c097d3fb..53063c50 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APReactionService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/APReactionService.kt @@ -1,13 +1,13 @@ -package dev.usbharu.hideout.service.ap +package dev.usbharu.hideout.activitypub.service.activity.like import com.fasterxml.jackson.databind.ObjectMapper -import dev.usbharu.hideout.domain.model.hideout.entity.Reaction -import dev.usbharu.hideout.domain.model.job.DeliverReactionJob -import dev.usbharu.hideout.domain.model.job.DeliverRemoveReactionJob -import dev.usbharu.hideout.query.FollowerQueryService -import dev.usbharu.hideout.query.PostQueryService -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.service.job.JobQueueParentService +import dev.usbharu.hideout.core.domain.model.reaction.Reaction +import dev.usbharu.hideout.core.external.job.DeliverReactionJob +import dev.usbharu.hideout.core.external.job.DeliverRemoveReactionJob +import dev.usbharu.hideout.core.query.FollowerQueryService +import dev.usbharu.hideout.core.query.PostQueryService +import dev.usbharu.hideout.core.query.UserQueryService +import dev.usbharu.hideout.core.service.job.JobQueueParentService import org.springframework.beans.factory.annotation.Qualifier import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApReactionJobService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/ApReactionJobService.kt similarity index 51% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApReactionJobService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/ApReactionJobService.kt index 90a029ae..ca43443f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApReactionJobService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/ApReactionJobService.kt @@ -1,7 +1,7 @@ -package dev.usbharu.hideout.service.ap.job +package dev.usbharu.hideout.activitypub.service.activity.like -import dev.usbharu.hideout.domain.model.job.DeliverReactionJob -import dev.usbharu.hideout.domain.model.job.DeliverRemoveReactionJob +import dev.usbharu.hideout.core.external.job.DeliverReactionJob +import dev.usbharu.hideout.core.external.job.DeliverRemoveReactionJob import kjob.core.job.JobProps interface ApReactionJobService { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApReactionJobServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/ApReactionJobServiceImpl.kt similarity index 79% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApReactionJobServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/ApReactionJobServiceImpl.kt index 45736662..e35f37d1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApReactionJobServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/ApReactionJobServiceImpl.kt @@ -1,14 +1,14 @@ -package dev.usbharu.hideout.service.ap.job +package dev.usbharu.hideout.activitypub.service.activity.like import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.readValue -import dev.usbharu.hideout.config.ApplicationConfig -import dev.usbharu.hideout.domain.model.ap.Like -import dev.usbharu.hideout.domain.model.ap.Undo -import dev.usbharu.hideout.domain.model.job.DeliverReactionJob -import dev.usbharu.hideout.domain.model.job.DeliverRemoveReactionJob -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.service.ap.APRequestService +import dev.usbharu.hideout.activitypub.domain.model.Like +import dev.usbharu.hideout.activitypub.domain.model.Undo +import dev.usbharu.hideout.activitypub.service.common.APRequestService +import dev.usbharu.hideout.application.config.ApplicationConfig +import dev.usbharu.hideout.core.external.job.DeliverReactionJob +import dev.usbharu.hideout.core.external.job.DeliverRemoveReactionJob +import dev.usbharu.hideout.core.query.UserQueryService import kjob.core.job.JobProps import org.springframework.beans.factory.annotation.Qualifier import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APUndoService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APUndoService.kt similarity index 74% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/APUndoService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APUndoService.kt index a9e8f176..84a6d60c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APUndoService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APUndoService.kt @@ -1,12 +1,13 @@ -package dev.usbharu.hideout.service.ap +package dev.usbharu.hideout.activitypub.service.activity.undo -import dev.usbharu.hideout.domain.model.ActivityPubResponse -import dev.usbharu.hideout.domain.model.ActivityPubStringResponse -import dev.usbharu.hideout.domain.model.ap.Follow -import dev.usbharu.hideout.domain.model.ap.Undo -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.service.core.Transaction -import dev.usbharu.hideout.service.user.UserService +import dev.usbharu.hideout.activitypub.domain.model.Follow +import dev.usbharu.hideout.activitypub.domain.model.Undo +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubResponse +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubStringResponse +import dev.usbharu.hideout.activitypub.service.`object`.user.APUserService +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.query.UserQueryService +import dev.usbharu.hideout.core.service.user.UserService import io.ktor.http.* import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APRequestService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APRequestService.kt similarity index 80% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/APRequestService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APRequestService.kt index be5c5796..8ac971a7 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APRequestService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APRequestService.kt @@ -1,7 +1,7 @@ -package dev.usbharu.hideout.service.ap +package dev.usbharu.hideout.activitypub.service.common -import dev.usbharu.hideout.domain.model.ap.Object -import dev.usbharu.hideout.domain.model.hideout.entity.User +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object +import dev.usbharu.hideout.core.domain.model.user.User interface APRequestService { suspend fun apGet(url: String, signer: User? = null, responseClass: Class): R diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APRequestServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APRequestServiceImpl.kt similarity index 97% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/APRequestServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APRequestServiceImpl.kt index c4f78ec7..395f6906 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APRequestServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APRequestServiceImpl.kt @@ -1,8 +1,8 @@ -package dev.usbharu.hideout.service.ap +package dev.usbharu.hideout.activitypub.service.common import com.fasterxml.jackson.databind.ObjectMapper -import dev.usbharu.hideout.domain.model.ap.Object -import dev.usbharu.hideout.domain.model.hideout.entity.User +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object +import dev.usbharu.hideout.core.domain.model.user.User import dev.usbharu.hideout.util.Base64Util import dev.usbharu.hideout.util.HttpUtil.Activity import dev.usbharu.hideout.util.RsaUtil diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/resource/APResourceResolveService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APResourceResolveService.kt similarity index 74% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/resource/APResourceResolveService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APResourceResolveService.kt index 7815f088..c5ac196c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/resource/APResourceResolveService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APResourceResolveService.kt @@ -1,7 +1,7 @@ -package dev.usbharu.hideout.service.ap.resource +package dev.usbharu.hideout.activitypub.service.common -import dev.usbharu.hideout.domain.model.ap.Object -import dev.usbharu.hideout.domain.model.hideout.entity.User +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object +import dev.usbharu.hideout.core.domain.model.user.User interface APResourceResolveService { suspend fun resolve(url: String, clazz: Class, singer: User?): T diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/resource/APResourceResolveServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APResourceResolveServiceImpl.kt similarity index 85% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/resource/APResourceResolveServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APResourceResolveServiceImpl.kt index 962f4563..cc3c08ac 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/resource/APResourceResolveServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APResourceResolveServiceImpl.kt @@ -1,9 +1,8 @@ -package dev.usbharu.hideout.service.ap.resource +package dev.usbharu.hideout.activitypub.service.common -import dev.usbharu.hideout.domain.model.ap.Object -import dev.usbharu.hideout.domain.model.hideout.entity.User -import dev.usbharu.hideout.repository.UserRepository -import dev.usbharu.hideout.service.ap.APRequestService +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object +import dev.usbharu.hideout.core.domain.model.user.User +import dev.usbharu.hideout.core.domain.model.user.UserRepository import org.springframework.stereotype.Service @Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APService.kt similarity index 88% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/APService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APService.kt index 8ea18249..102929da 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/APService.kt @@ -1,11 +1,16 @@ -package dev.usbharu.hideout.service.ap +package dev.usbharu.hideout.activitypub.service.common import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.readValue -import dev.usbharu.hideout.domain.model.ActivityPubResponse -import dev.usbharu.hideout.domain.model.ap.Follow -import dev.usbharu.hideout.exception.JsonParseException +import dev.usbharu.hideout.activitypub.domain.exception.JsonParseException +import dev.usbharu.hideout.activitypub.domain.model.Follow +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubResponse +import dev.usbharu.hideout.activitypub.service.activity.accept.APAcceptService +import dev.usbharu.hideout.activitypub.service.activity.create.APCreateService +import dev.usbharu.hideout.activitypub.service.activity.follow.APReceiveFollowService +import dev.usbharu.hideout.activitypub.service.activity.like.APLikeService +import dev.usbharu.hideout.activitypub.service.activity.undo.APUndoService import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Qualifier diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApJobService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ApJobService.kt similarity index 60% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApJobService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ApJobService.kt index 196b74c9..fe909b0d 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApJobService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ApJobService.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.service.ap.job +package dev.usbharu.hideout.activitypub.service.common -import dev.usbharu.hideout.domain.model.job.HideoutJob +import dev.usbharu.hideout.core.external.job.HideoutJob import kjob.core.dsl.JobContextWithProps interface ApJobService { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApJobServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ApJobServiceImpl.kt similarity index 81% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApJobServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ApJobServiceImpl.kt index 266b74d0..b57679f2 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApJobServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/ApJobServiceImpl.kt @@ -1,6 +1,9 @@ -package dev.usbharu.hideout.service.ap.job +package dev.usbharu.hideout.activitypub.service.common -import dev.usbharu.hideout.domain.model.job.* +import dev.usbharu.hideout.activitypub.service.activity.follow.APReceiveFollowJobService +import dev.usbharu.hideout.activitypub.service.activity.like.ApReactionJobService +import dev.usbharu.hideout.activitypub.service.`object`.note.ApNoteJobService +import dev.usbharu.hideout.core.external.job.* import kjob.core.dsl.JobContextWithProps import kjob.core.job.JobProps import org.slf4j.LoggerFactory diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/resource/CacheManager.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/CacheManager.kt similarity index 53% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/resource/CacheManager.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/CacheManager.kt index 909e7c62..1723f138 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/resource/CacheManager.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/CacheManager.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.service.ap.resource +package dev.usbharu.hideout.activitypub.service.common -import dev.usbharu.hideout.domain.model.ap.Object +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object interface CacheManager { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/resource/InMemoryCacheManager.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/InMemoryCacheManager.kt similarity index 92% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/resource/InMemoryCacheManager.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/InMemoryCacheManager.kt index e68692bd..70ac6147 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/resource/InMemoryCacheManager.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/common/InMemoryCacheManager.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.service.ap.resource +package dev.usbharu.hideout.activitypub.service.common -import dev.usbharu.hideout.domain.model.ap.Object +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object import dev.usbharu.hideout.util.LruCache import kotlinx.coroutines.delay import kotlinx.coroutines.sync.Mutex diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APNoteService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/APNoteService.kt similarity index 84% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/APNoteService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/APNoteService.kt index 0a9e4926..29d7c2be 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APNoteService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/APNoteService.kt @@ -1,23 +1,24 @@ -package dev.usbharu.hideout.service.ap +package dev.usbharu.hideout.activitypub.service.`object`.note import com.fasterxml.jackson.databind.ObjectMapper -import dev.usbharu.hideout.domain.model.ap.Note -import dev.usbharu.hideout.domain.model.hideout.entity.Post -import dev.usbharu.hideout.domain.model.hideout.entity.Visibility -import dev.usbharu.hideout.domain.model.job.DeliverPostJob -import dev.usbharu.hideout.exception.FailedToGetResourcesException -import dev.usbharu.hideout.exception.ap.FailedToGetActivityPubResourceException -import dev.usbharu.hideout.exception.ap.IllegalActivityPubObjectException -import dev.usbharu.hideout.query.FollowerQueryService -import dev.usbharu.hideout.query.MediaQueryService -import dev.usbharu.hideout.query.PostQueryService -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.repository.PostRepository -import dev.usbharu.hideout.service.ap.resource.APResourceResolveService -import dev.usbharu.hideout.service.ap.resource.resolve -import dev.usbharu.hideout.service.job.JobQueueParentService -import dev.usbharu.hideout.service.post.PostCreateInterceptor -import dev.usbharu.hideout.service.post.PostService +import dev.usbharu.hideout.activitypub.domain.exception.FailedToGetActivityPubResourceException +import dev.usbharu.hideout.activitypub.domain.exception.IllegalActivityPubObjectException +import dev.usbharu.hideout.activitypub.domain.model.Note +import dev.usbharu.hideout.activitypub.service.common.APResourceResolveService +import dev.usbharu.hideout.activitypub.service.common.resolve +import dev.usbharu.hideout.activitypub.service.`object`.user.APUserService +import dev.usbharu.hideout.core.domain.exception.FailedToGetResourcesException +import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.domain.model.post.PostRepository +import dev.usbharu.hideout.core.domain.model.post.Visibility +import dev.usbharu.hideout.core.external.job.DeliverPostJob +import dev.usbharu.hideout.core.query.FollowerQueryService +import dev.usbharu.hideout.core.query.MediaQueryService +import dev.usbharu.hideout.core.query.PostQueryService +import dev.usbharu.hideout.core.query.UserQueryService +import dev.usbharu.hideout.core.service.job.JobQueueParentService +import dev.usbharu.hideout.core.service.post.PostCreateInterceptor +import dev.usbharu.hideout.core.service.post.PostService import io.ktor.client.plugins.* import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Deferred diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApNoteJobService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/ApNoteJobService.kt similarity index 50% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApNoteJobService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/ApNoteJobService.kt index 35d7e3cb..875791a2 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApNoteJobService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/ApNoteJobService.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.service.ap.job +package dev.usbharu.hideout.activitypub.service.`object`.note -import dev.usbharu.hideout.domain.model.job.DeliverPostJob +import dev.usbharu.hideout.core.external.job.DeliverPostJob import kjob.core.job.JobProps interface ApNoteJobService { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApNoteJobServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/ApNoteJobServiceImpl.kt similarity index 74% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApNoteJobServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/ApNoteJobServiceImpl.kt index 8146a597..ba2804f5 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/job/ApNoteJobServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/ApNoteJobServiceImpl.kt @@ -1,17 +1,17 @@ -package dev.usbharu.hideout.service.ap.job +package dev.usbharu.hideout.activitypub.service.`object`.note import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.readValue -import dev.usbharu.hideout.config.ApplicationConfig -import dev.usbharu.hideout.domain.model.ap.Create -import dev.usbharu.hideout.domain.model.ap.Document -import dev.usbharu.hideout.domain.model.ap.Note -import dev.usbharu.hideout.domain.model.hideout.entity.Post -import dev.usbharu.hideout.domain.model.job.DeliverPostJob -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.service.ap.APNoteServiceImpl -import dev.usbharu.hideout.service.ap.APRequestService -import dev.usbharu.hideout.service.core.Transaction +import dev.usbharu.hideout.activitypub.domain.model.Create +import dev.usbharu.hideout.activitypub.domain.model.Document +import dev.usbharu.hideout.activitypub.domain.model.Note +import dev.usbharu.hideout.activitypub.service.common.APRequestService +import dev.usbharu.hideout.application.config.ApplicationConfig +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.domain.model.media.Media +import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.external.job.DeliverPostJob +import dev.usbharu.hideout.core.query.UserQueryService import kjob.core.job.JobProps import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Qualifier @@ -30,7 +30,7 @@ class ApNoteJobServiceImpl( val actor = props[DeliverPostJob.actor] val postEntity = objectMapper.readValue(props[DeliverPostJob.post]) val mediaList = - objectMapper.readValue>( + objectMapper.readValue>( props[DeliverPostJob.media] ) val note = Note( diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/NoteApApiService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/NoteApApiService.kt new file mode 100644 index 00000000..9402363d --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/NoteApApiService.kt @@ -0,0 +1,7 @@ +package dev.usbharu.hideout.activitypub.service.`object`.note + +import dev.usbharu.hideout.activitypub.domain.model.Note + +interface NoteApApiService { + suspend fun getNote(postId: Long, userId: Long?): Note? +} diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/NoteApApiServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/NoteApApiServiceImpl.kt similarity index 73% rename from src/main/kotlin/dev/usbharu/hideout/service/api/NoteApApiServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/NoteApApiServiceImpl.kt index 4fb14cfd..d3646e04 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/NoteApApiServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/note/NoteApApiServiceImpl.kt @@ -1,10 +1,10 @@ -package dev.usbharu.hideout.service.api +package dev.usbharu.hideout.activitypub.service.`object`.note -import dev.usbharu.hideout.domain.model.ap.Note -import dev.usbharu.hideout.domain.model.hideout.entity.Visibility -import dev.usbharu.hideout.query.FollowerQueryService -import dev.usbharu.hideout.query.activitypub.NoteQueryService -import dev.usbharu.hideout.service.core.Transaction +import dev.usbharu.hideout.activitypub.domain.model.Note +import dev.usbharu.hideout.activitypub.query.NoteQueryService +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.domain.model.post.Visibility +import dev.usbharu.hideout.core.query.FollowerQueryService import org.springframework.stereotype.Service @Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APUserService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/user/APUserService.kt similarity index 83% rename from src/main/kotlin/dev/usbharu/hideout/service/ap/APUserService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/user/APUserService.kt index 23f7b57b..4c476dda 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APUserService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/object/user/APUserService.kt @@ -1,18 +1,18 @@ -package dev.usbharu.hideout.service.ap +package dev.usbharu.hideout.activitypub.service.`object`.user -import dev.usbharu.hideout.config.ApplicationConfig -import dev.usbharu.hideout.domain.model.ap.Image -import dev.usbharu.hideout.domain.model.ap.Key -import dev.usbharu.hideout.domain.model.ap.Person -import dev.usbharu.hideout.domain.model.hideout.dto.RemoteUserCreateDto -import dev.usbharu.hideout.domain.model.hideout.entity.User -import dev.usbharu.hideout.exception.FailedToGetResourcesException -import dev.usbharu.hideout.exception.ap.IllegalActivityPubObjectException -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.service.ap.resource.APResourceResolveService -import dev.usbharu.hideout.service.ap.resource.resolve -import dev.usbharu.hideout.service.core.Transaction -import dev.usbharu.hideout.service.user.UserService +import dev.usbharu.hideout.activitypub.domain.exception.IllegalActivityPubObjectException +import dev.usbharu.hideout.activitypub.domain.model.Image +import dev.usbharu.hideout.activitypub.domain.model.Key +import dev.usbharu.hideout.activitypub.domain.model.Person +import dev.usbharu.hideout.activitypub.service.common.APResourceResolveService +import dev.usbharu.hideout.activitypub.service.common.resolve +import dev.usbharu.hideout.application.config.ApplicationConfig +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.domain.exception.FailedToGetResourcesException +import dev.usbharu.hideout.core.domain.model.user.User +import dev.usbharu.hideout.core.query.UserQueryService +import dev.usbharu.hideout.core.service.user.RemoteUserCreateDto +import dev.usbharu.hideout.core.service.user.UserService import org.springframework.stereotype.Service interface APUserService { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/WebFingerApiService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/webfinger/WebFingerApiService.kt similarity index 69% rename from src/main/kotlin/dev/usbharu/hideout/service/api/WebFingerApiService.kt rename to src/main/kotlin/dev/usbharu/hideout/activitypub/service/webfinger/WebFingerApiService.kt index e12a596c..d4af15fa 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/WebFingerApiService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/webfinger/WebFingerApiService.kt @@ -1,8 +1,8 @@ -package dev.usbharu.hideout.service.api +package dev.usbharu.hideout.activitypub.service.webfinger -import dev.usbharu.hideout.domain.model.hideout.entity.User -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.service.core.Transaction +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.domain.model.user.User +import dev.usbharu.hideout.core.query.UserQueryService import org.springframework.stereotype.Service @Service diff --git a/src/main/kotlin/dev/usbharu/hideout/SpringApplication.kt b/src/main/kotlin/dev/usbharu/hideout/application/SpringApplication.kt similarity index 91% rename from src/main/kotlin/dev/usbharu/hideout/SpringApplication.kt rename to src/main/kotlin/dev/usbharu/hideout/application/SpringApplication.kt index bbc2e3bd..4d59dee9 100644 --- a/src/main/kotlin/dev/usbharu/hideout/SpringApplication.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/SpringApplication.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout +package dev.usbharu.hideout.application import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.context.properties.ConfigurationPropertiesScan diff --git a/src/main/kotlin/dev/usbharu/hideout/config/ActivityPubConfig.kt b/src/main/kotlin/dev/usbharu/hideout/application/config/ActivityPubConfig.kt similarity index 96% rename from src/main/kotlin/dev/usbharu/hideout/config/ActivityPubConfig.kt rename to src/main/kotlin/dev/usbharu/hideout/application/config/ActivityPubConfig.kt index 8d83c5dd..70d35829 100644 --- a/src/main/kotlin/dev/usbharu/hideout/config/ActivityPubConfig.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/config/ActivityPubConfig.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.config +package dev.usbharu.hideout.application.config import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.databind.DeserializationFeature diff --git a/src/main/kotlin/dev/usbharu/hideout/config/AwsConfig.kt b/src/main/kotlin/dev/usbharu/hideout/application/config/AwsConfig.kt similarity index 93% rename from src/main/kotlin/dev/usbharu/hideout/config/AwsConfig.kt rename to src/main/kotlin/dev/usbharu/hideout/application/config/AwsConfig.kt index b697bb61..67820efd 100644 --- a/src/main/kotlin/dev/usbharu/hideout/config/AwsConfig.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/config/AwsConfig.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.config +package dev.usbharu.hideout.application.config import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration diff --git a/src/main/kotlin/dev/usbharu/hideout/config/HttpClientConfig.kt b/src/main/kotlin/dev/usbharu/hideout/application/config/HttpClientConfig.kt similarity index 92% rename from src/main/kotlin/dev/usbharu/hideout/config/HttpClientConfig.kt rename to src/main/kotlin/dev/usbharu/hideout/application/config/HttpClientConfig.kt index 0daa4aa0..51222c8f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/config/HttpClientConfig.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/config/HttpClientConfig.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.config +package dev.usbharu.hideout.application.config import io.ktor.client.* import io.ktor.client.engine.cio.* diff --git a/src/main/kotlin/dev/usbharu/hideout/JobQueueRunner.kt b/src/main/kotlin/dev/usbharu/hideout/application/config/JobQueueRunner.kt similarity index 82% rename from src/main/kotlin/dev/usbharu/hideout/JobQueueRunner.kt rename to src/main/kotlin/dev/usbharu/hideout/application/config/JobQueueRunner.kt index 697ab365..4f7f1aaf 100644 --- a/src/main/kotlin/dev/usbharu/hideout/JobQueueRunner.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/config/JobQueueRunner.kt @@ -1,9 +1,9 @@ -package dev.usbharu.hideout +package dev.usbharu.hideout.application.config -import dev.usbharu.hideout.domain.model.job.HideoutJob -import dev.usbharu.hideout.service.ap.job.ApJobService -import dev.usbharu.hideout.service.job.JobQueueParentService -import dev.usbharu.hideout.service.job.JobQueueWorkerService +import dev.usbharu.hideout.activitypub.service.common.ApJobService +import dev.usbharu.hideout.core.external.job.HideoutJob +import dev.usbharu.hideout.core.service.job.JobQueueParentService +import dev.usbharu.hideout.core.service.job.JobQueueWorkerService import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.boot.ApplicationArguments diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/MdcXrequestIdFilter.kt b/src/main/kotlin/dev/usbharu/hideout/application/config/MdcXrequestIdFilter.kt similarity index 94% rename from src/main/kotlin/dev/usbharu/hideout/service/core/MdcXrequestIdFilter.kt rename to src/main/kotlin/dev/usbharu/hideout/application/config/MdcXrequestIdFilter.kt index ddbc8a01..6e4cf8eb 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/MdcXrequestIdFilter.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/config/MdcXrequestIdFilter.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.core +package dev.usbharu.hideout.application.config import jakarta.servlet.Filter import jakarta.servlet.FilterChain diff --git a/src/main/kotlin/dev/usbharu/hideout/config/MvcConfigurer.kt b/src/main/kotlin/dev/usbharu/hideout/application/config/MvcConfigurer.kt similarity index 91% rename from src/main/kotlin/dev/usbharu/hideout/config/MvcConfigurer.kt rename to src/main/kotlin/dev/usbharu/hideout/application/config/MvcConfigurer.kt index d6afcfe6..5d9afe05 100644 --- a/src/main/kotlin/dev/usbharu/hideout/config/MvcConfigurer.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/config/MvcConfigurer.kt @@ -1,5 +1,6 @@ -package dev.usbharu.hideout.config +package dev.usbharu.hideout.application.config +import dev.usbharu.hideout.generate.JsonOrFormModelMethodProcessor import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.http.converter.HttpMessageConverter diff --git a/src/main/kotlin/dev/usbharu/hideout/config/SecurityConfig.kt b/src/main/kotlin/dev/usbharu/hideout/application/config/SecurityConfig.kt similarity index 95% rename from src/main/kotlin/dev/usbharu/hideout/config/SecurityConfig.kt rename to src/main/kotlin/dev/usbharu/hideout/application/config/SecurityConfig.kt index 2f5b4f59..850f857b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/config/SecurityConfig.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/config/SecurityConfig.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.config +package dev.usbharu.hideout.application.config import com.fasterxml.jackson.annotation.JsonInclude import com.nimbusds.jose.jwk.JWKSet @@ -6,12 +6,12 @@ import com.nimbusds.jose.jwk.RSAKey import com.nimbusds.jose.jwk.source.ImmutableJWKSet import com.nimbusds.jose.jwk.source.JWKSource import com.nimbusds.jose.proc.SecurityContext -import dev.usbharu.hideout.domain.model.UserDetailsImpl -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.service.core.Transaction -import dev.usbharu.hideout.service.signature.HttpSignatureFilter -import dev.usbharu.hideout.service.signature.HttpSignatureUserDetailsService -import dev.usbharu.hideout.service.signature.HttpSignatureVerifierComposite +import dev.usbharu.hideout.core.infrastructure.springframework.oauth2.UserDetailsImpl +import dev.usbharu.hideout.core.query.UserQueryService +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.infrastructure.springframework.httpsignature.HttpSignatureFilter +import dev.usbharu.hideout.core.infrastructure.springframework.httpsignature.HttpSignatureUserDetailsService +import dev.usbharu.hideout.core.infrastructure.springframework.httpsignature.HttpSignatureVerifierComposite import dev.usbharu.hideout.util.RsaUtil import dev.usbharu.httpsignature.sign.RsaSha256HttpSignatureSigner import dev.usbharu.httpsignature.verify.DefaultSignatureHeaderParser diff --git a/src/main/kotlin/dev/usbharu/hideout/config/SpringConfig.kt b/src/main/kotlin/dev/usbharu/hideout/application/config/SpringConfig.kt similarity index 97% rename from src/main/kotlin/dev/usbharu/hideout/config/SpringConfig.kt rename to src/main/kotlin/dev/usbharu/hideout/application/config/SpringConfig.kt index a7932b53..89275999 100644 --- a/src/main/kotlin/dev/usbharu/hideout/config/SpringConfig.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/config/SpringConfig.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.config +package dev.usbharu.hideout.application.config import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.context.properties.ConfigurationProperties diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/Transaction.kt b/src/main/kotlin/dev/usbharu/hideout/application/external/Transaction.kt similarity index 82% rename from src/main/kotlin/dev/usbharu/hideout/service/core/Transaction.kt rename to src/main/kotlin/dev/usbharu/hideout/application/external/Transaction.kt index a5c787a2..d55e46e5 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/Transaction.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/external/Transaction.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.core +package dev.usbharu.hideout.application.external import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/ExposedTransaction.kt b/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedTransaction.kt similarity index 83% rename from src/main/kotlin/dev/usbharu/hideout/service/core/ExposedTransaction.kt rename to src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedTransaction.kt index f0ed0568..3438d428 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/ExposedTransaction.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedTransaction.kt @@ -1,5 +1,6 @@ -package dev.usbharu.hideout.service.core +package dev.usbharu.hideout.application.infrastructure.exposed +import dev.usbharu.hideout.application.external.Transaction import kotlinx.coroutines.slf4j.MDCContext import org.jetbrains.exposed.sql.transactions.experimental.newSuspendedTransaction import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/QueryMapper.kt b/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/QueryMapper.kt similarity index 62% rename from src/main/kotlin/dev/usbharu/hideout/repository/QueryMapper.kt rename to src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/QueryMapper.kt index b5b5fdad..0aa0a0c1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/QueryMapper.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/QueryMapper.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.application.infrastructure.exposed import org.jetbrains.exposed.sql.Query diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/ResultRowMapper.kt b/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ResultRowMapper.kt similarity index 64% rename from src/main/kotlin/dev/usbharu/hideout/repository/ResultRowMapper.kt rename to src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ResultRowMapper.kt index e2ea4b3f..fa7f6f50 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/ResultRowMapper.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ResultRowMapper.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.application.infrastructure.exposed import org.jetbrains.exposed.sql.ResultRow diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/IdGenerateService.kt b/src/main/kotlin/dev/usbharu/hideout/application/service/id/IdGenerateService.kt similarity index 70% rename from src/main/kotlin/dev/usbharu/hideout/service/core/IdGenerateService.kt rename to src/main/kotlin/dev/usbharu/hideout/application/service/id/IdGenerateService.kt index fae8a683..2ada361e 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/IdGenerateService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/service/id/IdGenerateService.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.core +package dev.usbharu.hideout.application.service.id import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/SnowflakeIdGenerateService.kt b/src/main/kotlin/dev/usbharu/hideout/application/service/id/SnowflakeIdGenerateService.kt similarity index 96% rename from src/main/kotlin/dev/usbharu/hideout/service/core/SnowflakeIdGenerateService.kt rename to src/main/kotlin/dev/usbharu/hideout/application/service/id/SnowflakeIdGenerateService.kt index e90ea2d6..dc5ab4bc 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/SnowflakeIdGenerateService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/service/id/SnowflakeIdGenerateService.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.core +package dev.usbharu.hideout.application.service.id import kotlinx.coroutines.delay import kotlinx.coroutines.sync.Mutex diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/TwitterSnowflakeIdGenerateService.kt b/src/main/kotlin/dev/usbharu/hideout/application/service/id/TwitterSnowflakeIdGenerateService.kt similarity index 83% rename from src/main/kotlin/dev/usbharu/hideout/service/core/TwitterSnowflakeIdGenerateService.kt rename to src/main/kotlin/dev/usbharu/hideout/application/service/id/TwitterSnowflakeIdGenerateService.kt index e3e46739..98dce398 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/TwitterSnowflakeIdGenerateService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/service/id/TwitterSnowflakeIdGenerateService.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.core +package dev.usbharu.hideout.application.service.id import org.springframework.context.annotation.Primary import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/MetaService.kt b/src/main/kotlin/dev/usbharu/hideout/application/service/init/MetaService.kt similarity index 53% rename from src/main/kotlin/dev/usbharu/hideout/service/core/MetaService.kt rename to src/main/kotlin/dev/usbharu/hideout/application/service/init/MetaService.kt index a455d1b1..cece6bb1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/MetaService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/service/init/MetaService.kt @@ -1,7 +1,7 @@ -package dev.usbharu.hideout.service.core +package dev.usbharu.hideout.application.service.init -import dev.usbharu.hideout.domain.model.hideout.entity.Jwt -import dev.usbharu.hideout.domain.model.hideout.entity.Meta +import dev.usbharu.hideout.core.domain.model.meta.Jwt +import dev.usbharu.hideout.core.domain.model.meta.Meta import org.springframework.stereotype.Service @Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/MetaServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/application/service/init/MetaServiceImpl.kt similarity index 59% rename from src/main/kotlin/dev/usbharu/hideout/service/core/MetaServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/application/service/init/MetaServiceImpl.kt index 7dac4813..bf0d5ef9 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/MetaServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/service/init/MetaServiceImpl.kt @@ -1,9 +1,10 @@ -package dev.usbharu.hideout.service.core +package dev.usbharu.hideout.application.service.init -import dev.usbharu.hideout.domain.model.hideout.entity.Jwt -import dev.usbharu.hideout.domain.model.hideout.entity.Meta -import dev.usbharu.hideout.exception.NotInitException -import dev.usbharu.hideout.repository.MetaRepository +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.domain.exception.NotInitException +import dev.usbharu.hideout.core.domain.model.meta.Jwt +import dev.usbharu.hideout.core.domain.model.meta.Meta +import dev.usbharu.hideout.core.domain.model.meta.MetaRepository import org.springframework.stereotype.Service @Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseService.kt b/src/main/kotlin/dev/usbharu/hideout/application/service/init/ServerInitialiseService.kt similarity index 69% rename from src/main/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseService.kt rename to src/main/kotlin/dev/usbharu/hideout/application/service/init/ServerInitialiseService.kt index edd234cd..5bcd2b35 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/service/init/ServerInitialiseService.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.core +package dev.usbharu.hideout.application.service.init import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/application/service/init/ServerInitialiseServiceImpl.kt similarity index 87% rename from src/main/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/application/service/init/ServerInitialiseServiceImpl.kt index fa3d1b9b..a110827d 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/service/init/ServerInitialiseServiceImpl.kt @@ -1,8 +1,9 @@ -package dev.usbharu.hideout.service.core +package dev.usbharu.hideout.application.service.init -import dev.usbharu.hideout.domain.model.hideout.entity.Jwt -import dev.usbharu.hideout.domain.model.hideout.entity.Meta -import dev.usbharu.hideout.repository.MetaRepository +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.domain.model.meta.Jwt +import dev.usbharu.hideout.core.domain.model.meta.Meta +import dev.usbharu.hideout.core.domain.model.meta.MetaRepository import dev.usbharu.hideout.util.ServerUtil import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/FailedToGetResourcesException.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/FailedToGetResourcesException.kt similarity index 89% rename from src/main/kotlin/dev/usbharu/hideout/exception/FailedToGetResourcesException.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/exception/FailedToGetResourcesException.kt index d13b5f72..b2bde16f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/exception/FailedToGetResourcesException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/FailedToGetResourcesException.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.exception +package dev.usbharu.hideout.core.domain.exception import java.io.Serial diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/HttpSignatureVerifyException.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/HttpSignatureVerifyException.kt similarity index 86% rename from src/main/kotlin/dev/usbharu/hideout/exception/HttpSignatureVerifyException.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/exception/HttpSignatureVerifyException.kt index edf64ed5..e0c3491e 100644 --- a/src/main/kotlin/dev/usbharu/hideout/exception/HttpSignatureVerifyException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/HttpSignatureVerifyException.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.exception +package dev.usbharu.hideout.core.domain.exception import java.io.Serial import javax.naming.AuthenticationException diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/NotInitException.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/NotInitException.kt similarity index 88% rename from src/main/kotlin/dev/usbharu/hideout/exception/NotInitException.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/exception/NotInitException.kt index 6155a46f..c27a5032 100644 --- a/src/main/kotlin/dev/usbharu/hideout/exception/NotInitException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/NotInitException.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.exception +package dev.usbharu.hideout.core.domain.exception import java.io.Serial diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/UserNotFoundException.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/UserNotFoundException.kt similarity index 88% rename from src/main/kotlin/dev/usbharu/hideout/exception/UserNotFoundException.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/exception/UserNotFoundException.kt index 39b5d675..4351a787 100644 --- a/src/main/kotlin/dev/usbharu/hideout/exception/UserNotFoundException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/UserNotFoundException.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.exception +package dev.usbharu.hideout.core.domain.exception import java.io.Serial diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/media/MediaConvertException.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaConvertException.kt similarity index 89% rename from src/main/kotlin/dev/usbharu/hideout/exception/media/MediaConvertException.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaConvertException.kt index 1082f080..d2d9d7c9 100644 --- a/src/main/kotlin/dev/usbharu/hideout/exception/media/MediaConvertException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaConvertException.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.exception.media +package dev.usbharu.hideout.core.domain.exception.media open class MediaConvertException : MediaException { constructor() : super() diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/media/MediaException.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaException.kt similarity index 89% rename from src/main/kotlin/dev/usbharu/hideout/exception/media/MediaException.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaException.kt index 922a42a8..538e3c72 100644 --- a/src/main/kotlin/dev/usbharu/hideout/exception/media/MediaException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaException.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.exception.media +package dev.usbharu.hideout.core.domain.exception.media abstract class MediaException : RuntimeException { constructor() : super() diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/media/MediaFileSizeException.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaFileSizeException.kt similarity index 89% rename from src/main/kotlin/dev/usbharu/hideout/exception/media/MediaFileSizeException.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaFileSizeException.kt index f7bd6536..f75b74c2 100644 --- a/src/main/kotlin/dev/usbharu/hideout/exception/media/MediaFileSizeException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaFileSizeException.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.exception.media +package dev.usbharu.hideout.core.domain.exception.media open class MediaFileSizeException : MediaException { constructor() : super() diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/media/MediaFileSizeIsZeroException.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaFileSizeIsZeroException.kt similarity index 89% rename from src/main/kotlin/dev/usbharu/hideout/exception/media/MediaFileSizeIsZeroException.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaFileSizeIsZeroException.kt index 523f94b0..74261698 100644 --- a/src/main/kotlin/dev/usbharu/hideout/exception/media/MediaFileSizeIsZeroException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaFileSizeIsZeroException.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.exception.media +package dev.usbharu.hideout.core.domain.exception.media class MediaFileSizeIsZeroException : MediaFileSizeException { constructor() : super() diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/media/MediaSaveException.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaSaveException.kt similarity index 89% rename from src/main/kotlin/dev/usbharu/hideout/exception/media/MediaSaveException.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaSaveException.kt index 8887a3fe..e0914794 100644 --- a/src/main/kotlin/dev/usbharu/hideout/exception/media/MediaSaveException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/MediaSaveException.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.exception.media +package dev.usbharu.hideout.core.domain.exception.media open class MediaSaveException : MediaException { constructor() : super() diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/media/UnsupportedMediaException.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/UnsupportedMediaException.kt similarity index 89% rename from src/main/kotlin/dev/usbharu/hideout/exception/media/UnsupportedMediaException.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/UnsupportedMediaException.kt index 2fd8fc23..7eea4e38 100644 --- a/src/main/kotlin/dev/usbharu/hideout/exception/media/UnsupportedMediaException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/exception/media/UnsupportedMediaException.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.exception.media +package dev.usbharu.hideout.core.domain.exception.media class UnsupportedMediaException : MediaException { constructor() : super() diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Media.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/media/Media.kt similarity index 62% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Media.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/model/media/Media.kt index 042388b7..bf5d35cb 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Media.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/media/Media.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.domain.model.hideout.entity +package dev.usbharu.hideout.core.domain.model.media -import dev.usbharu.hideout.domain.model.hideout.dto.FileType +import dev.usbharu.hideout.core.service.media.FileType data class Media( val id: Long, diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/MediaRepository.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/media/MediaRepository.kt similarity index 64% rename from src/main/kotlin/dev/usbharu/hideout/repository/MediaRepository.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/model/media/MediaRepository.kt index be55bb86..1e18f68b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/MediaRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/media/MediaRepository.kt @@ -1,6 +1,4 @@ -package dev.usbharu.hideout.repository - -import dev.usbharu.hideout.domain.model.hideout.entity.Media +package dev.usbharu.hideout.core.domain.model.media interface MediaRepository { suspend fun generateId(): Long diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Jwt.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/meta/Jwt.kt similarity index 63% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Jwt.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/model/meta/Jwt.kt index 07f3ad55..e9e841d3 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Jwt.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/meta/Jwt.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.hideout.entity +package dev.usbharu.hideout.core.domain.model.meta import java.util.* diff --git a/src/main/kotlin/dev/usbharu/hideout/core/domain/model/meta/Meta.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/meta/Meta.kt new file mode 100644 index 00000000..836c6ab0 --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/meta/Meta.kt @@ -0,0 +1,3 @@ +package dev.usbharu.hideout.core.domain.model.meta + +data class Meta(val version: String, val jwt: Jwt) diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/MetaRepository.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/meta/MetaRepository.kt similarity index 61% rename from src/main/kotlin/dev/usbharu/hideout/repository/MetaRepository.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/model/meta/MetaRepository.kt index af4eb65f..4ca9578c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/MetaRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/meta/MetaRepository.kt @@ -1,6 +1,5 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.domain.model.meta -import dev.usbharu.hideout.domain.model.hideout.entity.Meta import org.springframework.stereotype.Repository @Repository diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Post.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/post/Post.kt similarity index 95% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Post.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/model/post/Post.kt index 7bffa75e..e9e2f043 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Post.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/post/Post.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.domain.model.hideout.entity +package dev.usbharu.hideout.core.domain.model.post -import dev.usbharu.hideout.config.CharacterLimit +import dev.usbharu.hideout.application.config.CharacterLimit import org.springframework.stereotype.Component data class Post private constructor( diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/PostRepository.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/post/PostRepository.kt similarity index 73% rename from src/main/kotlin/dev/usbharu/hideout/repository/PostRepository.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/model/post/PostRepository.kt index 8011f282..f3ea8dce 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/PostRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/post/PostRepository.kt @@ -1,6 +1,5 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.domain.model.post -import dev.usbharu.hideout.domain.model.hideout.entity.Post import org.springframework.stereotype.Repository @Suppress("LongParameterList") diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Visibility.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/post/Visibility.kt similarity index 58% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Visibility.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/model/post/Visibility.kt index 9acf8c16..0e169803 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Visibility.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/post/Visibility.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.hideout.entity +package dev.usbharu.hideout.core.domain.model.post enum class Visibility { PUBLIC, diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Reaction.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/reaction/Reaction.kt similarity index 61% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Reaction.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/model/reaction/Reaction.kt index af943cf5..b84c1a2e 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Reaction.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/reaction/Reaction.kt @@ -1,3 +1,3 @@ -package dev.usbharu.hideout.domain.model.hideout.entity +package dev.usbharu.hideout.core.domain.model.reaction data class Reaction(val id: Long, val emojiId: Long, val postId: Long, val userId: Long) diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/ReactionRepository.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/reaction/ReactionRepository.kt similarity index 69% rename from src/main/kotlin/dev/usbharu/hideout/repository/ReactionRepository.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/model/reaction/ReactionRepository.kt index d98a0c84..5bfae20e 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/ReactionRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/reaction/ReactionRepository.kt @@ -1,6 +1,5 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.domain.model.reaction -import dev.usbharu.hideout.domain.model.hideout.entity.Reaction import org.springframework.stereotype.Repository @Repository diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Timeline.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/Timeline.kt similarity index 81% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Timeline.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/Timeline.kt index 73568b90..6739bd79 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Timeline.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/Timeline.kt @@ -1,5 +1,6 @@ -package dev.usbharu.hideout.domain.model.hideout.entity +package dev.usbharu.hideout.core.domain.model.timeline +import dev.usbharu.hideout.core.domain.model.post.Visibility import org.springframework.data.annotation.Id import org.springframework.data.mongodb.core.mapping.Document diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/TimelineRepository.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/TimelineRepository.kt similarity index 76% rename from src/main/kotlin/dev/usbharu/hideout/repository/TimelineRepository.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/TimelineRepository.kt index 76e9755c..ccea7d9e 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/TimelineRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/TimelineRepository.kt @@ -1,6 +1,4 @@ -package dev.usbharu.hideout.repository - -import dev.usbharu.hideout.domain.model.hideout.entity.Timeline +package dev.usbharu.hideout.core.domain.model.timeline interface TimelineRepository { suspend fun generateId(): Long diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/Acct.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/user/Acct.kt similarity index 67% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/Acct.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/model/user/Acct.kt index af771e1b..f4ea0cdc 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/Acct.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/user/Acct.kt @@ -1,3 +1,3 @@ -package dev.usbharu.hideout.domain.model +package dev.usbharu.hideout.core.domain.model.user data class Acct(val username: String, val domain: String? = null, val isRemote: Boolean = domain == null) diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/User.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/user/User.kt similarity index 97% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/User.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/model/user/User.kt index 302a3c1e..bf021757 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/User.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/user/User.kt @@ -1,7 +1,7 @@ -package dev.usbharu.hideout.domain.model.hideout.entity +package dev.usbharu.hideout.core.domain.model.user -import dev.usbharu.hideout.config.ApplicationConfig -import dev.usbharu.hideout.config.CharacterLimit +import dev.usbharu.hideout.application.config.ApplicationConfig +import dev.usbharu.hideout.application.config.CharacterLimit import org.slf4j.LoggerFactory import org.springframework.stereotype.Component import java.time.Instant diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/UserRepository.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/user/UserRepository.kt similarity index 80% rename from src/main/kotlin/dev/usbharu/hideout/repository/UserRepository.kt rename to src/main/kotlin/dev/usbharu/hideout/core/domain/model/user/UserRepository.kt index b00d66c4..25db9d37 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/UserRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/user/UserRepository.kt @@ -1,6 +1,5 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.domain.model.user -import dev.usbharu.hideout.domain.model.hideout.entity.User import org.springframework.stereotype.Repository @Suppress("TooManyFunctions") diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/job/HideoutJob.kt b/src/main/kotlin/dev/usbharu/hideout/core/external/job/HideoutJob.kt similarity index 97% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/job/HideoutJob.kt rename to src/main/kotlin/dev/usbharu/hideout/core/external/job/HideoutJob.kt index a4bc0510..b94488af 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/job/HideoutJob.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/external/job/HideoutJob.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.job +package dev.usbharu.hideout.core.external.job import kjob.core.Job import kjob.core.Prop diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/PostQueryMapper.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposed/PostQueryMapper.kt similarity index 55% rename from src/main/kotlin/dev/usbharu/hideout/repository/PostQueryMapper.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposed/PostQueryMapper.kt index f71d5492..8e87edfa 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/PostQueryMapper.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposed/PostQueryMapper.kt @@ -1,6 +1,10 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.infrastructure.exposed -import dev.usbharu.hideout.domain.model.hideout.entity.Post +import dev.usbharu.hideout.application.infrastructure.exposed.QueryMapper +import dev.usbharu.hideout.application.infrastructure.exposed.ResultRowMapper +import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.infrastructure.exposedrepository.Posts +import dev.usbharu.hideout.core.infrastructure.exposedrepository.PostsMedia import org.jetbrains.exposed.sql.Query import org.springframework.stereotype.Component diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/PostResultRowMapper.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposed/PostResultRowMapper.kt similarity index 73% rename from src/main/kotlin/dev/usbharu/hideout/repository/PostResultRowMapper.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposed/PostResultRowMapper.kt index 7949e401..8505a44d 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/PostResultRowMapper.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposed/PostResultRowMapper.kt @@ -1,7 +1,9 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.infrastructure.exposed -import dev.usbharu.hideout.domain.model.hideout.entity.Post -import dev.usbharu.hideout.domain.model.hideout.entity.Visibility +import dev.usbharu.hideout.application.infrastructure.exposed.ResultRowMapper +import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.domain.model.post.Visibility +import dev.usbharu.hideout.core.infrastructure.exposedrepository.Posts import org.jetbrains.exposed.sql.ResultRow import org.springframework.stereotype.Component diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/UserQueryMapper.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposed/UserQueryMapper.kt similarity index 52% rename from src/main/kotlin/dev/usbharu/hideout/repository/UserQueryMapper.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposed/UserQueryMapper.kt index d4969965..7361815c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/UserQueryMapper.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposed/UserQueryMapper.kt @@ -1,6 +1,8 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.infrastructure.exposed -import dev.usbharu.hideout.domain.model.hideout.entity.User +import dev.usbharu.hideout.application.infrastructure.exposed.QueryMapper +import dev.usbharu.hideout.application.infrastructure.exposed.ResultRowMapper +import dev.usbharu.hideout.core.domain.model.user.User import org.jetbrains.exposed.sql.Query import org.springframework.stereotype.Component diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/UserResultRowMapper.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposed/UserResultRowMapper.kt similarity index 80% rename from src/main/kotlin/dev/usbharu/hideout/repository/UserResultRowMapper.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposed/UserResultRowMapper.kt index 8470a2f6..c55a352a 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/UserResultRowMapper.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposed/UserResultRowMapper.kt @@ -1,6 +1,8 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.infrastructure.exposed -import dev.usbharu.hideout.domain.model.hideout.entity.User +import dev.usbharu.hideout.application.infrastructure.exposed.ResultRowMapper +import dev.usbharu.hideout.core.domain.model.user.User +import dev.usbharu.hideout.core.infrastructure.exposedrepository.Users import org.jetbrains.exposed.sql.ResultRow import org.springframework.stereotype.Component import java.time.Instant diff --git a/src/main/kotlin/dev/usbharu/hideout/query/FollowerQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/FollowerQueryServiceImpl.kt similarity index 96% rename from src/main/kotlin/dev/usbharu/hideout/query/FollowerQueryServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/FollowerQueryServiceImpl.kt index 75d27e7b..3034c0cb 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/FollowerQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/FollowerQueryServiceImpl.kt @@ -1,8 +1,9 @@ -package dev.usbharu.hideout.query +package dev.usbharu.hideout.core.infrastructure.exposedquery -import dev.usbharu.hideout.domain.model.hideout.entity.User -import dev.usbharu.hideout.repository.Users -import dev.usbharu.hideout.repository.UsersFollowers +import dev.usbharu.hideout.core.domain.model.user.User +import dev.usbharu.hideout.core.infrastructure.exposedrepository.Users +import dev.usbharu.hideout.core.infrastructure.exposedrepository.UsersFollowers +import dev.usbharu.hideout.core.query.FollowerQueryService import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq import org.springframework.stereotype.Repository diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/MediaQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/MediaQueryServiceImpl.kt new file mode 100644 index 00000000..41b19eee --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/MediaQueryServiceImpl.kt @@ -0,0 +1,21 @@ +package dev.usbharu.hideout.core.infrastructure.exposedquery + +import dev.usbharu.hideout.core.domain.model.media.Media +import dev.usbharu.hideout.core.infrastructure.exposedrepository.PostsMedia +import dev.usbharu.hideout.core.infrastructure.exposedrepository.toMedia +import dev.usbharu.hideout.core.query.MediaQueryService +import org.jetbrains.exposed.sql.innerJoin +import org.jetbrains.exposed.sql.select +import org.springframework.stereotype.Repository + +@Repository +class MediaQueryServiceImpl : MediaQueryService { + override suspend fun findByPostId(postId: Long): List { + return dev.usbharu.hideout.core.infrastructure.exposedrepository.Media.innerJoin( + PostsMedia, + onColumn = { id }, + otherColumn = { mediaId }) + .select { PostsMedia.postId eq postId } + .map { it.toMedia() } + } +} diff --git a/src/main/kotlin/dev/usbharu/hideout/query/PostQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/PostQueryServiceImpl.kt similarity index 67% rename from src/main/kotlin/dev/usbharu/hideout/query/PostQueryServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/PostQueryServiceImpl.kt index c6708dae..e4b45ef0 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/PostQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/PostQueryServiceImpl.kt @@ -1,11 +1,12 @@ -package dev.usbharu.hideout.query +package dev.usbharu.hideout.core.infrastructure.exposedquery -import dev.usbharu.hideout.domain.model.hideout.entity.Post -import dev.usbharu.hideout.exception.FailedToGetResourcesException -import dev.usbharu.hideout.repository.Posts -import dev.usbharu.hideout.repository.PostsMedia -import dev.usbharu.hideout.repository.QueryMapper -import dev.usbharu.hideout.repository.ResultRowMapper +import dev.usbharu.hideout.application.infrastructure.exposed.QueryMapper +import dev.usbharu.hideout.application.infrastructure.exposed.ResultRowMapper +import dev.usbharu.hideout.core.domain.exception.FailedToGetResourcesException +import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.infrastructure.exposedrepository.Posts +import dev.usbharu.hideout.core.infrastructure.exposedrepository.PostsMedia +import dev.usbharu.hideout.core.query.PostQueryService import dev.usbharu.hideout.util.singleOr import org.jetbrains.exposed.sql.select import org.springframework.stereotype.Repository diff --git a/src/main/kotlin/dev/usbharu/hideout/query/ReactionQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/ReactionQueryServiceImpl.kt similarity index 61% rename from src/main/kotlin/dev/usbharu/hideout/query/ReactionQueryServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/ReactionQueryServiceImpl.kt index 4d9897d9..83b49079 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/ReactionQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/ReactionQueryServiceImpl.kt @@ -1,12 +1,10 @@ -package dev.usbharu.hideout.query +package dev.usbharu.hideout.core.infrastructure.exposedquery -import dev.usbharu.hideout.domain.model.hideout.dto.Account -import dev.usbharu.hideout.domain.model.hideout.dto.ReactionResponse -import dev.usbharu.hideout.domain.model.hideout.entity.Reaction -import dev.usbharu.hideout.exception.FailedToGetResourcesException -import dev.usbharu.hideout.repository.Reactions -import dev.usbharu.hideout.repository.Users -import dev.usbharu.hideout.repository.toReaction +import dev.usbharu.hideout.core.domain.model.reaction.Reaction +import dev.usbharu.hideout.core.domain.exception.FailedToGetResourcesException +import dev.usbharu.hideout.core.query.ReactionQueryService +import dev.usbharu.hideout.core.infrastructure.exposedrepository.Reactions +import dev.usbharu.hideout.core.infrastructure.exposedrepository.toReaction import dev.usbharu.hideout.util.singleOr import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq @@ -49,13 +47,4 @@ class ReactionQueryServiceImpl : ReactionQueryService { Reactions.deleteWhere { Reactions.postId.eq(postId).and(Reactions.userId.eq(userId)) } } - override suspend fun findByPostIdWithUsers(postId: Long, userId: Long?): List { - return Reactions - .leftJoin(Users, onColumn = { Reactions.userId }, otherColumn = { id }) - .select { Reactions.postId.eq(postId) } - .groupBy { _: ResultRow -> ReactionResponse("❤", true, "", emptyList()) } - .map { entry: Map.Entry> -> - entry.key.copy(accounts = entry.value.map { Account(it[Users.screenName], "", it[Users.url]) }) - } - } } diff --git a/src/main/kotlin/dev/usbharu/hideout/query/UserQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/UserQueryServiceImpl.kt similarity index 82% rename from src/main/kotlin/dev/usbharu/hideout/query/UserQueryServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/UserQueryServiceImpl.kt index 3db693e1..e2a580e8 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/UserQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/UserQueryServiceImpl.kt @@ -1,10 +1,11 @@ -package dev.usbharu.hideout.query +package dev.usbharu.hideout.core.infrastructure.exposedquery -import dev.usbharu.hideout.domain.model.hideout.entity.User -import dev.usbharu.hideout.exception.FailedToGetResourcesException -import dev.usbharu.hideout.repository.QueryMapper -import dev.usbharu.hideout.repository.ResultRowMapper -import dev.usbharu.hideout.repository.Users +import dev.usbharu.hideout.application.infrastructure.exposed.QueryMapper +import dev.usbharu.hideout.application.infrastructure.exposed.ResultRowMapper +import dev.usbharu.hideout.core.domain.exception.FailedToGetResourcesException +import dev.usbharu.hideout.core.domain.model.user.User +import dev.usbharu.hideout.core.infrastructure.exposedrepository.Users +import dev.usbharu.hideout.core.query.UserQueryService import dev.usbharu.hideout.util.singleOr import org.jetbrains.exposed.sql.and import org.jetbrains.exposed.sql.select diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/MediaRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/MediaRepositoryImpl.kt similarity index 70% rename from src/main/kotlin/dev/usbharu/hideout/repository/MediaRepositoryImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/MediaRepositoryImpl.kt index 6bbacbd3..f47d946f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/MediaRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/MediaRepositoryImpl.kt @@ -1,13 +1,14 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.infrastructure.exposedrepository -import dev.usbharu.hideout.domain.model.hideout.dto.FileType -import dev.usbharu.hideout.exception.FailedToGetResourcesException -import dev.usbharu.hideout.service.core.IdGenerateService +import dev.usbharu.hideout.application.service.id.IdGenerateService +import dev.usbharu.hideout.core.domain.exception.FailedToGetResourcesException +import dev.usbharu.hideout.core.domain.model.media.MediaRepository +import dev.usbharu.hideout.core.service.media.FileType import dev.usbharu.hideout.util.singleOr import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq import org.springframework.stereotype.Repository -import dev.usbharu.hideout.domain.model.hideout.entity.Media as EntityMedia +import dev.usbharu.hideout.core.domain.model.media.Media as EntityMedia @Repository class MediaRepositoryImpl(private val idGenerateService: IdGenerateService) : MediaRepository { @@ -19,22 +20,22 @@ class MediaRepositoryImpl(private val idGenerateService: IdGenerateService) : Me }.singleOrNull() != null ) { Media.update({ Media.id eq media.id }) { - it[Media.name] = media.name - it[Media.url] = media.url - it[Media.remoteUrl] = media.remoteUrl - it[Media.thumbnailUrl] = media.thumbnailUrl - it[Media.type] = media.type.ordinal - it[Media.blurhash] = media.blurHash + it[name] = media.name + it[url] = media.url + it[remoteUrl] = media.remoteUrl + it[thumbnailUrl] = media.thumbnailUrl + it[type] = media.type.ordinal + it[blurhash] = media.blurHash } } else { Media.insert { - it[Media.id] = media.id - it[Media.name] = media.name - it[Media.url] = media.url - it[Media.remoteUrl] = media.remoteUrl - it[Media.thumbnailUrl] = media.thumbnailUrl - it[Media.type] = media.type.ordinal - it[Media.blurhash] = media.blurHash + it[id] = media.id + it[name] = media.name + it[url] = media.url + it[remoteUrl] = media.remoteUrl + it[thumbnailUrl] = media.thumbnailUrl + it[type] = media.type.ordinal + it[blurhash] = media.blurHash } } return media diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/MetaRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/MetaRepositoryImpl.kt similarity index 60% rename from src/main/kotlin/dev/usbharu/hideout/repository/MetaRepositoryImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/MetaRepositoryImpl.kt index 132d8428..493ba37c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/MetaRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/MetaRepositoryImpl.kt @@ -1,6 +1,7 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.infrastructure.exposedrepository -import dev.usbharu.hideout.domain.model.hideout.entity.Jwt +import dev.usbharu.hideout.core.domain.model.meta.Jwt +import dev.usbharu.hideout.core.domain.model.meta.MetaRepository import org.jetbrains.exposed.sql.* import org.springframework.stereotype.Repository import java.util.* @@ -8,28 +9,28 @@ import java.util.* @Repository class MetaRepositoryImpl : MetaRepository { - override suspend fun save(meta: dev.usbharu.hideout.domain.model.hideout.entity.Meta) { + override suspend fun save(meta: dev.usbharu.hideout.core.domain.model.meta.Meta) { if (Meta.select { Meta.id eq 1 }.empty()) { Meta.insert { it[id] = 1 - it[this.version] = meta.version + it[version] = meta.version it[kid] = UUID.randomUUID().toString() - it[this.jwtPrivateKey] = meta.jwt.privateKey - it[this.jwtPublicKey] = meta.jwt.publicKey + it[jwtPrivateKey] = meta.jwt.privateKey + it[jwtPublicKey] = meta.jwt.publicKey } } else { Meta.update({ Meta.id eq 1 }) { - it[this.version] = meta.version + it[version] = meta.version it[kid] = UUID.randomUUID().toString() - it[this.jwtPrivateKey] = meta.jwt.privateKey - it[this.jwtPublicKey] = meta.jwt.publicKey + it[jwtPrivateKey] = meta.jwt.privateKey + it[jwtPublicKey] = meta.jwt.publicKey } } } - override suspend fun get(): dev.usbharu.hideout.domain.model.hideout.entity.Meta? { + override suspend fun get(): dev.usbharu.hideout.core.domain.model.meta.Meta? { return Meta.select { Meta.id eq 1 }.singleOrNull()?.let { - dev.usbharu.hideout.domain.model.hideout.entity.Meta( + dev.usbharu.hideout.core.domain.model.meta.Meta( it[Meta.version], Jwt(UUID.fromString(it[Meta.kid]), it[Meta.jwtPrivateKey], it[Meta.jwtPublicKey]) ) diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/PostRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/PostRepositoryImpl.kt similarity index 88% rename from src/main/kotlin/dev/usbharu/hideout/repository/PostRepositoryImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/PostRepositoryImpl.kt index d0a8ee96..32064e6c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/PostRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/PostRepositoryImpl.kt @@ -1,8 +1,10 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.infrastructure.exposedrepository -import dev.usbharu.hideout.domain.model.hideout.entity.Post -import dev.usbharu.hideout.exception.FailedToGetResourcesException -import dev.usbharu.hideout.service.core.IdGenerateService +import dev.usbharu.hideout.application.infrastructure.exposed.QueryMapper +import dev.usbharu.hideout.application.service.id.IdGenerateService +import dev.usbharu.hideout.core.domain.exception.FailedToGetResourcesException +import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.domain.model.post.PostRepository import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq import org.springframework.stereotype.Repository @@ -37,7 +39,7 @@ class PostRepositoryImpl( } } else { PostsMedia.deleteWhere { - PostsMedia.postId eq post.id + postId eq post.id } PostsMedia.batchInsert(post.mediaIds) { this[PostsMedia.postId] = post.id @@ -65,7 +67,7 @@ class PostRepositoryImpl( } override suspend fun findById(id: Long): Post = - Posts.innerJoin(PostsMedia, onColumn = { Posts.id }, otherColumn = { PostsMedia.postId }) + Posts.innerJoin(PostsMedia, onColumn = { Posts.id }, otherColumn = { postId }) .select { Posts.id eq id } .let(postQueryMapper::map) .singleOrNull() diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/ReactionRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ReactionRepositoryImpl.kt similarity index 87% rename from src/main/kotlin/dev/usbharu/hideout/repository/ReactionRepositoryImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ReactionRepositoryImpl.kt index 806e7841..aca4b864 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/ReactionRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ReactionRepositoryImpl.kt @@ -1,7 +1,8 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.infrastructure.exposedrepository -import dev.usbharu.hideout.domain.model.hideout.entity.Reaction -import dev.usbharu.hideout.service.core.IdGenerateService +import dev.usbharu.hideout.core.domain.model.reaction.Reaction +import dev.usbharu.hideout.core.domain.model.reaction.ReactionRepository +import dev.usbharu.hideout.application.service.id.IdGenerateService import org.jetbrains.exposed.dao.id.LongIdTable import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/UserRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/UserRepositoryImpl.kt similarity index 93% rename from src/main/kotlin/dev/usbharu/hideout/repository/UserRepositoryImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/UserRepositoryImpl.kt index 1a37c5d2..6d45a5e7 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/UserRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/UserRepositoryImpl.kt @@ -1,7 +1,9 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.infrastructure.exposedrepository -import dev.usbharu.hideout.domain.model.hideout.entity.User -import dev.usbharu.hideout.service.core.IdGenerateService +import dev.usbharu.hideout.application.infrastructure.exposed.ResultRowMapper +import dev.usbharu.hideout.application.service.id.IdGenerateService +import dev.usbharu.hideout.core.domain.model.user.User +import dev.usbharu.hideout.core.domain.model.user.UserRepository import org.jetbrains.exposed.dao.id.LongIdTable import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq diff --git a/src/main/kotlin/dev/usbharu/kjob/exposed/ExposedJobRepository.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/ExposedJobRepository.kt similarity index 99% rename from src/main/kotlin/dev/usbharu/kjob/exposed/ExposedJobRepository.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/ExposedJobRepository.kt index 419aec37..989ee2ce 100644 --- a/src/main/kotlin/dev/usbharu/kjob/exposed/ExposedJobRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/ExposedJobRepository.kt @@ -1,4 +1,4 @@ -package dev.usbharu.kjob.exposed +package dev.usbharu.hideout.core.infrastructure.kjobexposed import kjob.core.job.JobProgress import kjob.core.job.JobSettings diff --git a/src/main/kotlin/dev/usbharu/kjob/exposed/ExposedKJob.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/ExposedKJob.kt similarity index 96% rename from src/main/kotlin/dev/usbharu/kjob/exposed/ExposedKJob.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/ExposedKJob.kt index 1a688f28..9e44fcb1 100644 --- a/src/main/kotlin/dev/usbharu/kjob/exposed/ExposedKJob.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/ExposedKJob.kt @@ -1,4 +1,4 @@ -package dev.usbharu.kjob.exposed +package dev.usbharu.hideout.core.infrastructure.kjobexposed import kjob.core.BaseKJob import kjob.core.KJob diff --git a/src/main/kotlin/dev/usbharu/kjob/exposed/ExposedLockRepository.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/ExposedLockRepository.kt similarity index 97% rename from src/main/kotlin/dev/usbharu/kjob/exposed/ExposedLockRepository.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/ExposedLockRepository.kt index fc990e92..355ff802 100644 --- a/src/main/kotlin/dev/usbharu/kjob/exposed/ExposedLockRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/ExposedLockRepository.kt @@ -1,4 +1,4 @@ -package dev.usbharu.kjob.exposed +package dev.usbharu.hideout.core.infrastructure.kjobexposed import kjob.core.job.Lock import kjob.core.repository.LockRepository diff --git a/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueParentService.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/KJobJobQueueParentService.kt similarity index 88% rename from src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueParentService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/KJobJobQueueParentService.kt index 6b2841d1..c8f711ab 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueParentService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/KJobJobQueueParentService.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.service.job +package dev.usbharu.hideout.core.infrastructure.kjobexposed -import dev.usbharu.kjob.exposed.ExposedKJob +import dev.usbharu.hideout.core.service.job.JobQueueParentService import kjob.core.Job import kjob.core.KJob import kjob.core.dsl.ScheduleContext diff --git a/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueWorkerService.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/KJobJobQueueWorkerService.kt similarity index 83% rename from src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueWorkerService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/KJobJobQueueWorkerService.kt index e355b388..d7c4fca2 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueWorkerService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/KJobJobQueueWorkerService.kt @@ -1,13 +1,13 @@ -package dev.usbharu.hideout.service.job +package dev.usbharu.hideout.core.infrastructure.kjobexposed -import dev.usbharu.kjob.exposed.ExposedKJob +import dev.usbharu.hideout.core.service.job.JobQueueWorkerService import kjob.core.dsl.JobRegisterContext import kjob.core.dsl.KJobFunctions import kjob.core.kjob import org.jetbrains.exposed.sql.Database import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.stereotype.Service -import dev.usbharu.hideout.domain.model.job.HideoutJob as HJ +import dev.usbharu.hideout.core.external.job.HideoutJob as HJ import kjob.core.dsl.JobContextWithProps as JCWP @Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/job/KJobMongoJobQueueWorkerService.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobmongodb/KJobMongoJobQueueWorkerService.kt similarity index 83% rename from src/main/kotlin/dev/usbharu/hideout/service/job/KJobMongoJobQueueWorkerService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobmongodb/KJobMongoJobQueueWorkerService.kt index 7ac05da6..01b57659 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/job/KJobMongoJobQueueWorkerService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobmongodb/KJobMongoJobQueueWorkerService.kt @@ -1,12 +1,13 @@ -package dev.usbharu.hideout.service.job +package dev.usbharu.hideout.core.infrastructure.kjobmongodb +import dev.usbharu.hideout.core.service.job.JobQueueWorkerService import kjob.core.dsl.JobRegisterContext import kjob.core.dsl.KJobFunctions import kjob.core.kjob import kjob.mongo.Mongo import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.stereotype.Service -import dev.usbharu.hideout.domain.model.job.HideoutJob as HJ +import dev.usbharu.hideout.core.external.job.HideoutJob as HJ import kjob.core.dsl.JobContextWithProps as JCWP @Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/job/KjobMongoJobQueueParentService.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobmongodb/KjobMongoJobQueueParentService.kt similarity index 87% rename from src/main/kotlin/dev/usbharu/hideout/service/job/KjobMongoJobQueueParentService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobmongodb/KjobMongoJobQueueParentService.kt index a2819257..40ad8cdf 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/job/KjobMongoJobQueueParentService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobmongodb/KjobMongoJobQueueParentService.kt @@ -1,5 +1,6 @@ -package dev.usbharu.hideout.service.job +package dev.usbharu.hideout.core.infrastructure.kjobmongodb +import dev.usbharu.hideout.core.service.job.JobQueueParentService import kjob.core.Job import kjob.core.dsl.ScheduleContext import kjob.core.kjob diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/MongoTimelineRepository.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/mongorepository/MongoTimelineRepository.kt similarity index 82% rename from src/main/kotlin/dev/usbharu/hideout/repository/MongoTimelineRepository.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/mongorepository/MongoTimelineRepository.kt index 0b8937cf..46c6918a 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/MongoTimelineRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/mongorepository/MongoTimelineRepository.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.infrastructure.mongorepository -import dev.usbharu.hideout.domain.model.hideout.entity.Timeline +import dev.usbharu.hideout.core.domain.model.timeline.Timeline import org.springframework.data.domain.Pageable import org.springframework.data.mongodb.repository.MongoRepository diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/MongoTimelineRepositoryWrapper.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/mongorepository/MongoTimelineRepositoryWrapper.kt similarity index 83% rename from src/main/kotlin/dev/usbharu/hideout/repository/MongoTimelineRepositoryWrapper.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/mongorepository/MongoTimelineRepositoryWrapper.kt index 3b2abb73..edf01212 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/MongoTimelineRepositoryWrapper.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/mongorepository/MongoTimelineRepositoryWrapper.kt @@ -1,7 +1,8 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.infrastructure.mongorepository -import dev.usbharu.hideout.domain.model.hideout.entity.Timeline -import dev.usbharu.hideout.service.core.IdGenerateService +import dev.usbharu.hideout.application.service.id.IdGenerateService +import dev.usbharu.hideout.core.domain.model.timeline.Timeline +import dev.usbharu.hideout.core.domain.model.timeline.TimelineRepository import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty diff --git a/src/main/kotlin/dev/usbharu/hideout/service/signature/HttpSignatureFilter.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureFilter.kt similarity index 95% rename from src/main/kotlin/dev/usbharu/hideout/service/signature/HttpSignatureFilter.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureFilter.kt index 6a2444b8..8b3c1b11 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/signature/HttpSignatureFilter.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureFilter.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.signature +package dev.usbharu.hideout.core.infrastructure.springframework.httpsignature import dev.usbharu.httpsignature.common.HttpHeaders import dev.usbharu.httpsignature.common.HttpMethod diff --git a/src/main/kotlin/dev/usbharu/hideout/service/signature/HttpSignatureUser.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureUser.kt similarity index 93% rename from src/main/kotlin/dev/usbharu/hideout/service/signature/HttpSignatureUser.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureUser.kt index cb6160ee..8beb4513 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/signature/HttpSignatureUser.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureUser.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.signature +package dev.usbharu.hideout.core.infrastructure.springframework.httpsignature import org.springframework.security.core.GrantedAuthority import org.springframework.security.core.userdetails.User diff --git a/src/main/kotlin/dev/usbharu/hideout/service/signature/HttpSignatureUserDetailsService.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureUserDetailsService.kt similarity index 88% rename from src/main/kotlin/dev/usbharu/hideout/service/signature/HttpSignatureUserDetailsService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureUserDetailsService.kt index ba12cca0..a2e2a258 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/signature/HttpSignatureUserDetailsService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureUserDetailsService.kt @@ -1,9 +1,9 @@ -package dev.usbharu.hideout.service.signature +package dev.usbharu.hideout.core.infrastructure.springframework.httpsignature -import dev.usbharu.hideout.exception.FailedToGetResourcesException -import dev.usbharu.hideout.exception.HttpSignatureVerifyException -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.service.core.Transaction +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.domain.exception.FailedToGetResourcesException +import dev.usbharu.hideout.core.domain.exception.HttpSignatureVerifyException +import dev.usbharu.hideout.core.query.UserQueryService import dev.usbharu.hideout.util.RsaUtil import dev.usbharu.httpsignature.common.HttpRequest import dev.usbharu.httpsignature.common.PublicKey diff --git a/src/main/kotlin/dev/usbharu/hideout/service/signature/HttpSignatureVerifierComposite.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureVerifierComposite.kt similarity index 91% rename from src/main/kotlin/dev/usbharu/hideout/service/signature/HttpSignatureVerifierComposite.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureVerifierComposite.kt index c6a0041f..a1203ca1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/signature/HttpSignatureVerifierComposite.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureVerifierComposite.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.signature +package dev.usbharu.hideout.core.infrastructure.springframework.httpsignature import dev.usbharu.httpsignature.common.HttpRequest import dev.usbharu.httpsignature.common.PublicKey diff --git a/src/main/kotlin/dev/usbharu/hideout/service/auth/ExposedOAuth2AuthorizationConsentService.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/ExposedOAuth2AuthorizationConsentService.kt similarity index 96% rename from src/main/kotlin/dev/usbharu/hideout/service/auth/ExposedOAuth2AuthorizationConsentService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/ExposedOAuth2AuthorizationConsentService.kt index d03ffde4..82438544 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/auth/ExposedOAuth2AuthorizationConsentService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/ExposedOAuth2AuthorizationConsentService.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.service.auth +package dev.usbharu.hideout.core.infrastructure.springframework.oauth2 -import dev.usbharu.hideout.service.core.Transaction +import dev.usbharu.hideout.application.external.Transaction import kotlinx.coroutines.runBlocking import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq diff --git a/src/main/kotlin/dev/usbharu/hideout/service/auth/ExposedOAuth2AuthorizationService.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/ExposedOAuth2AuthorizationService.kt similarity index 97% rename from src/main/kotlin/dev/usbharu/hideout/service/auth/ExposedOAuth2AuthorizationService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/ExposedOAuth2AuthorizationService.kt index 1d93e49b..458f805c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/auth/ExposedOAuth2AuthorizationService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/ExposedOAuth2AuthorizationService.kt @@ -1,11 +1,9 @@ -package dev.usbharu.hideout.service.auth +package dev.usbharu.hideout.core.infrastructure.springframework.oauth2 import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.readValue -import dev.usbharu.hideout.domain.model.UserDetailsImpl -import dev.usbharu.hideout.domain.model.UserDetailsMixin -import dev.usbharu.hideout.service.core.Transaction +import dev.usbharu.hideout.application.external.Transaction import kotlinx.coroutines.runBlocking import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq @@ -327,11 +325,11 @@ class ExposedOAuth2AuthorizationService( val classLoader = ExposedOAuth2AuthorizationService::class.java.classLoader val modules = SecurityJackson2Modules.getModules(classLoader) - this.objectMapper.registerModules(JavaTimeModule()) - this.objectMapper.registerModules(modules) - this.objectMapper.registerModules(OAuth2AuthorizationServerJackson2Module()) - this.objectMapper.registerModules(CoreJackson2Module()) - this.objectMapper.addMixIn(UserDetailsImpl::class.java, UserDetailsMixin::class.java) + objectMapper.registerModules(JavaTimeModule()) + objectMapper.registerModules(modules) + objectMapper.registerModules(OAuth2AuthorizationServerJackson2Module()) + objectMapper.registerModules(CoreJackson2Module()) + objectMapper.addMixIn(UserDetailsImpl::class.java, UserDetailsMixin::class.java) } } } diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/RegisteredClientRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/RegisteredClientRepositoryImpl.kt similarity index 94% rename from src/main/kotlin/dev/usbharu/hideout/repository/RegisteredClientRepositoryImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/RegisteredClientRepositoryImpl.kt index 7c72725f..ed07c162 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/RegisteredClientRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/RegisteredClientRepositoryImpl.kt @@ -1,12 +1,11 @@ -package dev.usbharu.hideout.repository +package dev.usbharu.hideout.core.infrastructure.springframework.oauth2 import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.readValue -import dev.usbharu.hideout.repository.RegisteredClient.clientId -import dev.usbharu.hideout.repository.RegisteredClient.clientSettings -import dev.usbharu.hideout.repository.RegisteredClient.tokenSettings -import dev.usbharu.hideout.service.auth.ExposedOAuth2AuthorizationService +import dev.usbharu.hideout.core.infrastructure.springframework.oauth2.RegisteredClient.clientId +import dev.usbharu.hideout.core.infrastructure.springframework.oauth2.RegisteredClient.clientSettings +import dev.usbharu.hideout.core.infrastructure.springframework.oauth2.RegisteredClient.tokenSettings import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.javatime.CurrentTimestamp import org.jetbrains.exposed.sql.javatime.timestamp @@ -164,9 +163,9 @@ class RegisteredClientRepositoryImpl : RegisteredClientRepository { val classLoader = ExposedOAuth2AuthorizationService::class.java.classLoader val modules = SecurityJackson2Modules.getModules(classLoader) - this.objectMapper.registerModules(JavaTimeModule()) - this.objectMapper.registerModules(modules) - this.objectMapper.registerModules(OAuth2AuthorizationServerJackson2Module()) + objectMapper.registerModules(JavaTimeModule()) + objectMapper.registerModules(modules) + objectMapper.registerModules(OAuth2AuthorizationServerJackson2Module()) } } } diff --git a/src/main/kotlin/dev/usbharu/hideout/service/auth/SecureTokenGenerator.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/SecureTokenGenerator.kt similarity index 63% rename from src/main/kotlin/dev/usbharu/hideout/service/auth/SecureTokenGenerator.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/SecureTokenGenerator.kt index 81b7a793..4f8d59b5 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/auth/SecureTokenGenerator.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/SecureTokenGenerator.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.auth +package dev.usbharu.hideout.core.infrastructure.springframework.oauth2 import org.springframework.stereotype.Component diff --git a/src/main/kotlin/dev/usbharu/hideout/service/auth/SecureTokenGeneratorImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/SecureTokenGeneratorImpl.kt similarity index 85% rename from src/main/kotlin/dev/usbharu/hideout/service/auth/SecureTokenGeneratorImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/SecureTokenGeneratorImpl.kt index 4015dfed..9c649464 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/auth/SecureTokenGeneratorImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/SecureTokenGeneratorImpl.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.auth +package dev.usbharu.hideout.core.infrastructure.springframework.oauth2 import org.springframework.stereotype.Component import java.security.SecureRandom diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/UserDetailsImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/UserDetailsImpl.kt similarity index 96% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/UserDetailsImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/UserDetailsImpl.kt index 94812bbc..92b007da 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/UserDetailsImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/UserDetailsImpl.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model +package dev.usbharu.hideout.core.infrastructure.springframework.oauth2 import com.fasterxml.jackson.annotation.JsonAutoDetect import com.fasterxml.jackson.annotation.JsonIgnoreProperties @@ -52,7 +52,7 @@ class UserDetailsDeserializer : JsonDeserializer() { val jsonNode: JsonNode = mapper.readTree(p) val authorities: Set = mapper.convertValue( jsonNode["authorities"], - Companion.SIMPLE_GRANTED_AUTHORITY_SET + SIMPLE_GRANTED_AUTHORITY_SET ) val password = jsonNode.readText("password") diff --git a/src/main/kotlin/dev/usbharu/hideout/service/auth/UserDetailsServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/UserDetailsServiceImpl.kt similarity index 83% rename from src/main/kotlin/dev/usbharu/hideout/service/auth/UserDetailsServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/UserDetailsServiceImpl.kt index f4573fae..b8ac029c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/auth/UserDetailsServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/UserDetailsServiceImpl.kt @@ -1,9 +1,8 @@ -package dev.usbharu.hideout.service.auth +package dev.usbharu.hideout.core.infrastructure.springframework.oauth2 -import dev.usbharu.hideout.config.ApplicationConfig -import dev.usbharu.hideout.domain.model.UserDetailsImpl -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.service.core.Transaction +import dev.usbharu.hideout.application.config.ApplicationConfig +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.query.UserQueryService import kotlinx.coroutines.runBlocking import org.springframework.security.core.userdetails.UserDetails import org.springframework.security.core.userdetails.UserDetailsService diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/AuthController.kt b/src/main/kotlin/dev/usbharu/hideout/core/interfaces/api/auth/AuthController.kt similarity index 80% rename from src/main/kotlin/dev/usbharu/hideout/controller/AuthController.kt rename to src/main/kotlin/dev/usbharu/hideout/core/interfaces/api/auth/AuthController.kt index c91b1f34..b42f791b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/AuthController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/interfaces/api/auth/AuthController.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.controller +package dev.usbharu.hideout.core.interfaces.api.auth import org.springframework.stereotype.Controller import org.springframework.web.bind.annotation.GetMapping diff --git a/src/main/kotlin/dev/usbharu/hideout/query/FollowerQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/core/query/FollowerQueryService.kt similarity index 84% rename from src/main/kotlin/dev/usbharu/hideout/query/FollowerQueryService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/query/FollowerQueryService.kt index 4922b268..e5935576 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/FollowerQueryService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/query/FollowerQueryService.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.query +package dev.usbharu.hideout.core.query -import dev.usbharu.hideout.domain.model.hideout.entity.User +import dev.usbharu.hideout.core.domain.model.user.User interface FollowerQueryService { suspend fun findFollowersById(id: Long): List diff --git a/src/main/kotlin/dev/usbharu/hideout/core/query/MediaQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/core/query/MediaQueryService.kt new file mode 100644 index 00000000..fc7fb675 --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/core/query/MediaQueryService.kt @@ -0,0 +1,7 @@ +package dev.usbharu.hideout.core.query + +import dev.usbharu.hideout.core.domain.model.media.Media + +interface MediaQueryService { + suspend fun findByPostId(postId: Long): List +} diff --git a/src/main/kotlin/dev/usbharu/hideout/query/PostQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/core/query/PostQueryService.kt similarity index 70% rename from src/main/kotlin/dev/usbharu/hideout/query/PostQueryService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/query/PostQueryService.kt index 2a67b1fe..415db265 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/PostQueryService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/query/PostQueryService.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.query +package dev.usbharu.hideout.core.query -import dev.usbharu.hideout.domain.model.hideout.entity.Post +import dev.usbharu.hideout.core.domain.model.post.Post import org.springframework.stereotype.Repository @Repository diff --git a/src/main/kotlin/dev/usbharu/hideout/query/ReactionQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/core/query/ReactionQueryService.kt similarity index 64% rename from src/main/kotlin/dev/usbharu/hideout/query/ReactionQueryService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/query/ReactionQueryService.kt index fa81a62c..0fe19f61 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/ReactionQueryService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/query/ReactionQueryService.kt @@ -1,7 +1,6 @@ -package dev.usbharu.hideout.query +package dev.usbharu.hideout.core.query -import dev.usbharu.hideout.domain.model.hideout.dto.ReactionResponse -import dev.usbharu.hideout.domain.model.hideout.entity.Reaction +import dev.usbharu.hideout.core.domain.model.reaction.Reaction import org.springframework.stereotype.Repository @Repository @@ -15,5 +14,4 @@ interface ReactionQueryService { suspend fun deleteByPostIdAndUserId(postId: Long, userId: Long) - suspend fun findByPostIdWithUsers(postId: Long, userId: Long? = null): List } diff --git a/src/main/kotlin/dev/usbharu/hideout/query/UserQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/core/query/UserQueryService.kt similarity index 85% rename from src/main/kotlin/dev/usbharu/hideout/query/UserQueryService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/query/UserQueryService.kt index 0bab8304..9b78ae4e 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/UserQueryService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/query/UserQueryService.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.query +package dev.usbharu.hideout.core.query -import dev.usbharu.hideout.domain.model.hideout.entity.User +import dev.usbharu.hideout.core.domain.model.user.User import org.springframework.stereotype.Repository @Repository diff --git a/src/main/kotlin/dev/usbharu/hideout/core/service/follow/SendFollowDto.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/follow/SendFollowDto.kt new file mode 100644 index 00000000..53b55c00 --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/follow/SendFollowDto.kt @@ -0,0 +1,5 @@ +package dev.usbharu.hideout.core.service.follow + +import dev.usbharu.hideout.core.domain.model.user.User + +data class SendFollowDto(val userId: User, val followTargetUserId: User) diff --git a/src/main/kotlin/dev/usbharu/hideout/service/job/JobQueueParentService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueParentService.kt similarity index 85% rename from src/main/kotlin/dev/usbharu/hideout/service/job/JobQueueParentService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueParentService.kt index dfecf8a4..38f8111f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/job/JobQueueParentService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueParentService.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.job +package dev.usbharu.hideout.core.service.job import kjob.core.Job import kjob.core.dsl.ScheduleContext diff --git a/src/main/kotlin/dev/usbharu/hideout/service/job/JobQueueWorkerService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueWorkerService.kt similarity index 75% rename from src/main/kotlin/dev/usbharu/hideout/service/job/JobQueueWorkerService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueWorkerService.kt index c7cb2f13..982dbeb0 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/job/JobQueueWorkerService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueWorkerService.kt @@ -1,8 +1,8 @@ -package dev.usbharu.hideout.service.job +package dev.usbharu.hideout.core.service.job import kjob.core.dsl.KJobFunctions import org.springframework.stereotype.Service -import dev.usbharu.hideout.domain.model.job.HideoutJob as HJ +import dev.usbharu.hideout.core.external.job.HideoutJob as HJ import kjob.core.dsl.JobContextWithProps as JCWP import kjob.core.dsl.JobRegisterContext as JRC diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/FileType.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/FileType.kt similarity index 56% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/FileType.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/FileType.kt index a72ac82a..2ee1c3ba 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/FileType.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/FileType.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.hideout.dto +package dev.usbharu.hideout.core.service.media enum class FileType { Image, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/FileTypeDeterminationService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/FileTypeDeterminationService.kt similarity index 56% rename from src/main/kotlin/dev/usbharu/hideout/service/media/FileTypeDeterminationService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/FileTypeDeterminationService.kt index 5849feea..f19f72be 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/FileTypeDeterminationService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/FileTypeDeterminationService.kt @@ -1,6 +1,4 @@ -package dev.usbharu.hideout.service.media - -import dev.usbharu.hideout.domain.model.hideout.dto.FileType +package dev.usbharu.hideout.core.service.media interface FileTypeDeterminationService { fun fileType(byteArray: ByteArray, filename: String, contentType: String?): FileType diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/FileTypeDeterminationServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/FileTypeDeterminationServiceImpl.kt similarity index 86% rename from src/main/kotlin/dev/usbharu/hideout/service/media/FileTypeDeterminationServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/FileTypeDeterminationServiceImpl.kt index a13ebf66..8d5d0226 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/FileTypeDeterminationServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/FileTypeDeterminationServiceImpl.kt @@ -1,6 +1,5 @@ -package dev.usbharu.hideout.service.media +package dev.usbharu.hideout.core.service.media -import dev.usbharu.hideout.domain.model.hideout.dto.FileType import org.springframework.stereotype.Component @Component diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/MediaBlurhashService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaBlurhashService.kt similarity index 74% rename from src/main/kotlin/dev/usbharu/hideout/service/media/MediaBlurhashService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaBlurhashService.kt index 490a2ffe..ec021c96 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/MediaBlurhashService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaBlurhashService.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.media +package dev.usbharu.hideout.core.service.media import java.awt.image.BufferedImage diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/MediaBlurhashServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaBlurhashServiceImpl.kt similarity index 86% rename from src/main/kotlin/dev/usbharu/hideout/service/media/MediaBlurhashServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaBlurhashServiceImpl.kt index d2156796..115920d0 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/MediaBlurhashServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaBlurhashServiceImpl.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.media +package dev.usbharu.hideout.core.service.media import io.trbl.blurhash.BlurHash import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaDataStore.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaDataStore.kt new file mode 100644 index 00000000..0545a577 --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaDataStore.kt @@ -0,0 +1,6 @@ +package dev.usbharu.hideout.core.service.media + +interface MediaDataStore { + suspend fun save(dataMediaSave: MediaSave): SavedMedia + suspend fun delete(id: String) +} diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/MediaSave.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaSave.kt similarity index 75% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/MediaSave.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaSave.kt index 0a32a8e3..3529ace9 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/MediaSave.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaSave.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model +package dev.usbharu.hideout.core.service.media data class MediaSave( val name: String, diff --git a/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaService.kt new file mode 100644 index 00000000..75d928e8 --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaService.kt @@ -0,0 +1,8 @@ +package dev.usbharu.hideout.core.service.media + +import dev.usbharu.hideout.mastodon.interfaces.api.media.MediaRequest + +interface MediaService { + suspend fun uploadLocalMedia(mediaRequest: MediaRequest): dev.usbharu.hideout.core.domain.model.media.Media + suspend fun uploadRemoteMedia(remoteMedia: RemoteMedia) +} diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/MediaServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaServiceImpl.kt similarity index 62% rename from src/main/kotlin/dev/usbharu/hideout/service/media/MediaServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaServiceImpl.kt index b208f2f3..46884853 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/MediaServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/MediaServiceImpl.kt @@ -1,23 +1,18 @@ -package dev.usbharu.hideout.service.media +package dev.usbharu.hideout.core.service.media -import dev.usbharu.hideout.domain.model.MediaSave -import dev.usbharu.hideout.domain.model.hideout.dto.FaildSavedMedia -import dev.usbharu.hideout.domain.model.hideout.dto.FileType -import dev.usbharu.hideout.domain.model.hideout.dto.RemoteMedia -import dev.usbharu.hideout.domain.model.hideout.dto.SuccessSavedMedia -import dev.usbharu.hideout.domain.model.hideout.form.Media -import dev.usbharu.hideout.exception.media.MediaFileSizeIsZeroException -import dev.usbharu.hideout.exception.media.MediaSaveException -import dev.usbharu.hideout.exception.media.UnsupportedMediaException -import dev.usbharu.hideout.repository.MediaRepository -import dev.usbharu.hideout.service.media.converter.MediaProcessService +import dev.usbharu.hideout.core.domain.exception.media.MediaFileSizeIsZeroException +import dev.usbharu.hideout.core.domain.exception.media.MediaSaveException +import dev.usbharu.hideout.core.domain.exception.media.UnsupportedMediaException +import dev.usbharu.hideout.core.domain.model.media.MediaRepository +import dev.usbharu.hideout.core.service.media.converter.MediaProcessService +import dev.usbharu.hideout.mastodon.interfaces.api.media.MediaRequest import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.slf4j.LoggerFactory import org.springframework.stereotype.Service import java.util.* import javax.imageio.ImageIO -import dev.usbharu.hideout.domain.model.hideout.entity.Media as EntityMedia +import dev.usbharu.hideout.core.domain.model.media.Media as EntityMedia @Service @Suppress("TooGenericExceptionCaught") @@ -28,26 +23,30 @@ class MediaServiceImpl( private val mediaRepository: MediaRepository, private val mediaProcessService: MediaProcessService ) : MediaService { - override suspend fun uploadLocalMedia(media: Media): EntityMedia { + override suspend fun uploadLocalMedia(mediaRequest: MediaRequest): EntityMedia { logger.info( - "Media upload. filename:${media.file.name} size:${media.file.size} contentType:${media.file.contentType}" + "Media upload. filename:${mediaRequest.file.name} size:${mediaRequest.file.size} contentType:${mediaRequest.file.contentType}" ) - if (media.file.size == 0L) { + if (mediaRequest.file.size == 0L) { throw MediaFileSizeIsZeroException("Media file size is zero.") } - val fileType = fileTypeDeterminationService.fileType(media.file.bytes, media.file.name, media.file.contentType) + val fileType = fileTypeDeterminationService.fileType( + mediaRequest.file.bytes, + mediaRequest.file.name, + mediaRequest.file.contentType + ) if (fileType != FileType.Image) { throw UnsupportedMediaException("FileType: $fileType is not supported.") } val process = mediaProcessService.process( fileType, - media.file.contentType.orEmpty(), - media.file.name, - media.file.bytes, - media.thumbnail?.bytes + mediaRequest.file.contentType.orEmpty(), + mediaRequest.file.name, + mediaRequest.file.bytes, + mediaRequest.thumbnail?.bytes ) val dataMediaSave = MediaSave( @@ -72,13 +71,13 @@ class MediaServiceImpl( save as SuccessSavedMedia val blurHash = withContext(Dispatchers.IO) { - mediaBlurhashService.generateBlurhash(ImageIO.read(media.file.bytes.inputStream())) + mediaBlurhashService.generateBlurhash(ImageIO.read(mediaRequest.file.bytes.inputStream())) } return mediaRepository.save( EntityMedia( id = mediaRepository.generateId(), - name = media.file.name, + name = mediaRequest.file.name, url = save.url, remoteUrl = null, thumbnailUrl = save.thumbnailUrl, diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/ProcessedFile.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/ProcessedFile.kt similarity index 61% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/ProcessedFile.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/ProcessedFile.kt index 1bf60d6c..c138ed43 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/ProcessedFile.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/ProcessedFile.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.hideout.dto +package dev.usbharu.hideout.core.service.media data class ProcessedFile( val byteArray: ByteArray, diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/ProcessedMedia.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/ProcessedMedia.kt similarity index 63% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/ProcessedMedia.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/ProcessedMedia.kt index b11416e8..9dff2a8a 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/ProcessedMedia.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/ProcessedMedia.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.hideout.dto +package dev.usbharu.hideout.core.service.media data class ProcessedMedia( val file: ProcessedFile, diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/RemoteMedia.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/RemoteMedia.kt similarity index 64% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/RemoteMedia.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/RemoteMedia.kt index d4428ad1..273487c3 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/RemoteMedia.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/RemoteMedia.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.hideout.dto +package dev.usbharu.hideout.core.service.media data class RemoteMedia( val name: String, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/S3MediaDataStore.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/S3MediaDataStore.kt similarity index 90% rename from src/main/kotlin/dev/usbharu/hideout/service/media/S3MediaDataStore.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/S3MediaDataStore.kt index 6dd357c5..0b60aac4 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/S3MediaDataStore.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/S3MediaDataStore.kt @@ -1,9 +1,6 @@ -package dev.usbharu.hideout.service.media +package dev.usbharu.hideout.core.service.media -import dev.usbharu.hideout.config.StorageConfig -import dev.usbharu.hideout.domain.model.MediaSave -import dev.usbharu.hideout.domain.model.hideout.dto.SavedMedia -import dev.usbharu.hideout.domain.model.hideout.dto.SuccessSavedMedia +import dev.usbharu.hideout.application.config.StorageConfig import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/SavedMedia.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/SavedMedia.kt similarity index 85% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/SavedMedia.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/SavedMedia.kt index b8ab7490..4f644da5 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/SavedMedia.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/SavedMedia.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.hideout.dto +package dev.usbharu.hideout.core.service.media sealed class SavedMedia(val success: Boolean) diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/ThumbnailGenerateService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/ThumbnailGenerateService.kt similarity index 68% rename from src/main/kotlin/dev/usbharu/hideout/service/media/ThumbnailGenerateService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/ThumbnailGenerateService.kt index cb8438d6..b2a9acc9 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/ThumbnailGenerateService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/ThumbnailGenerateService.kt @@ -1,6 +1,5 @@ -package dev.usbharu.hideout.service.media +package dev.usbharu.hideout.core.service.media -import dev.usbharu.hideout.domain.model.hideout.dto.ProcessedFile import java.io.InputStream interface ThumbnailGenerateService { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/ThumbnailGenerateServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/ThumbnailGenerateServiceImpl.kt similarity index 89% rename from src/main/kotlin/dev/usbharu/hideout/service/media/ThumbnailGenerateServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/ThumbnailGenerateServiceImpl.kt index 7f736de5..cae3174c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/ThumbnailGenerateServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/ThumbnailGenerateServiceImpl.kt @@ -1,6 +1,5 @@ -package dev.usbharu.hideout.service.media +package dev.usbharu.hideout.core.service.media -import dev.usbharu.hideout.domain.model.hideout.dto.ProcessedFile import org.springframework.stereotype.Service import java.awt.image.BufferedImage import java.io.ByteArrayOutputStream diff --git a/src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaConverter.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaConverter.kt new file mode 100644 index 00000000..5ed1f693 --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaConverter.kt @@ -0,0 +1,10 @@ +package dev.usbharu.hideout.core.service.media.converter + +import dev.usbharu.hideout.core.service.media.FileType +import dev.usbharu.hideout.core.service.media.ProcessedFile +import java.io.InputStream + +interface MediaConverter { + fun isSupport(fileType: FileType): Boolean + fun convert(inputStream: InputStream): ProcessedFile +} diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaConverterRoot.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaConverterRoot.kt similarity index 55% rename from src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaConverterRoot.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaConverterRoot.kt index 4965da2a..6790b088 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaConverterRoot.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaConverterRoot.kt @@ -1,7 +1,7 @@ -package dev.usbharu.hideout.service.media.converter +package dev.usbharu.hideout.core.service.media.converter -import dev.usbharu.hideout.domain.model.hideout.dto.FileType -import dev.usbharu.hideout.domain.model.hideout.dto.ProcessedFile +import dev.usbharu.hideout.core.service.media.FileType +import dev.usbharu.hideout.core.service.media.ProcessedFile import java.io.InputStream interface MediaConverterRoot { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaConverterRootImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaConverterRootImpl.kt similarity index 83% rename from src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaConverterRootImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaConverterRootImpl.kt index 4d340bef..16f7ffb4 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaConverterRootImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaConverterRootImpl.kt @@ -1,7 +1,7 @@ -package dev.usbharu.hideout.service.media.converter +package dev.usbharu.hideout.core.service.media.converter -import dev.usbharu.hideout.domain.model.hideout.dto.FileType -import dev.usbharu.hideout.domain.model.hideout.dto.ProcessedFile +import dev.usbharu.hideout.core.service.media.FileType +import dev.usbharu.hideout.core.service.media.ProcessedFile import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaProcessService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaProcessService.kt similarity index 55% rename from src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaProcessService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaProcessService.kt index 5df2c16a..a7fed906 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaProcessService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaProcessService.kt @@ -1,7 +1,7 @@ -package dev.usbharu.hideout.service.media.converter +package dev.usbharu.hideout.core.service.media.converter -import dev.usbharu.hideout.domain.model.hideout.dto.FileType -import dev.usbharu.hideout.domain.model.hideout.dto.ProcessedMedia +import dev.usbharu.hideout.core.service.media.FileType +import dev.usbharu.hideout.core.service.media.ProcessedMedia interface MediaProcessService { suspend fun process( diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaProcessServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaProcessServiceImpl.kt similarity index 81% rename from src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaProcessServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaProcessServiceImpl.kt index 7ad96ecd..e95b324a 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaProcessServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/media/converter/MediaProcessServiceImpl.kt @@ -1,9 +1,9 @@ -package dev.usbharu.hideout.service.media.converter +package dev.usbharu.hideout.core.service.media.converter -import dev.usbharu.hideout.domain.model.hideout.dto.FileType -import dev.usbharu.hideout.domain.model.hideout.dto.ProcessedMedia -import dev.usbharu.hideout.exception.media.MediaConvertException -import dev.usbharu.hideout.service.media.ThumbnailGenerateService +import dev.usbharu.hideout.core.domain.exception.media.MediaConvertException +import dev.usbharu.hideout.core.service.media.FileType +import dev.usbharu.hideout.core.service.media.ProcessedMedia +import dev.usbharu.hideout.core.service.media.ThumbnailGenerateService import org.slf4j.LoggerFactory import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/PostCreateDto.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/post/PostCreateDto.kt similarity index 69% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/PostCreateDto.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/post/PostCreateDto.kt index c9cf69de..24317956 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/PostCreateDto.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/post/PostCreateDto.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.domain.model.hideout.dto +package dev.usbharu.hideout.core.service.post -import dev.usbharu.hideout.domain.model.hideout.entity.Visibility +import dev.usbharu.hideout.core.domain.model.post.Visibility data class PostCreateDto( val text: String, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/post/PostService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/post/PostService.kt similarity index 65% rename from src/main/kotlin/dev/usbharu/hideout/service/post/PostService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/post/PostService.kt index 641ac4cd..f311628b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/post/PostService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/post/PostService.kt @@ -1,7 +1,6 @@ -package dev.usbharu.hideout.service.post +package dev.usbharu.hideout.core.service.post -import dev.usbharu.hideout.domain.model.hideout.dto.PostCreateDto -import dev.usbharu.hideout.domain.model.hideout.entity.Post +import dev.usbharu.hideout.core.domain.model.post.Post import org.springframework.stereotype.Service @Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/post/PostServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/post/PostServiceImpl.kt similarity index 85% rename from src/main/kotlin/dev/usbharu/hideout/service/post/PostServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/post/PostServiceImpl.kt index a22666fa..a91a9b72 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/post/PostServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/post/PostServiceImpl.kt @@ -1,11 +1,11 @@ -package dev.usbharu.hideout.service.post +package dev.usbharu.hideout.core.service.post -import dev.usbharu.hideout.domain.model.hideout.dto.PostCreateDto -import dev.usbharu.hideout.domain.model.hideout.entity.Post -import dev.usbharu.hideout.exception.UserNotFoundException -import dev.usbharu.hideout.query.PostQueryService -import dev.usbharu.hideout.repository.PostRepository -import dev.usbharu.hideout.repository.UserRepository +import dev.usbharu.hideout.core.domain.exception.UserNotFoundException +import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.domain.model.post.PostRepository +import dev.usbharu.hideout.core.domain.model.user.UserRepository +import dev.usbharu.hideout.core.query.PostQueryService +import dev.usbharu.hideout.core.service.timeline.TimelineService import org.jetbrains.exposed.exceptions.ExposedSQLException import org.slf4j.LoggerFactory import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/reaction/ReactionService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/reaction/ReactionService.kt similarity index 85% rename from src/main/kotlin/dev/usbharu/hideout/service/reaction/ReactionService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/reaction/ReactionService.kt index d39dc483..3e00918a 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/reaction/ReactionService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/reaction/ReactionService.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.reaction +package dev.usbharu.hideout.core.service.reaction import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/reaction/ReactionServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/reaction/ReactionServiceImpl.kt similarity index 82% rename from src/main/kotlin/dev/usbharu/hideout/service/reaction/ReactionServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/reaction/ReactionServiceImpl.kt index 134e0ba6..e8b95679 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/reaction/ReactionServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/reaction/ReactionServiceImpl.kt @@ -1,9 +1,9 @@ -package dev.usbharu.hideout.service.reaction +package dev.usbharu.hideout.core.service.reaction -import dev.usbharu.hideout.domain.model.hideout.entity.Reaction -import dev.usbharu.hideout.query.ReactionQueryService -import dev.usbharu.hideout.repository.ReactionRepository -import dev.usbharu.hideout.service.ap.APReactionService +import dev.usbharu.hideout.core.domain.model.reaction.Reaction +import dev.usbharu.hideout.core.query.ReactionQueryService +import dev.usbharu.hideout.core.domain.model.reaction.ReactionRepository +import dev.usbharu.hideout.activitypub.service.activity.like.APReactionService import org.jetbrains.exposed.exceptions.ExposedSQLException import org.slf4j.LoggerFactory import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/post/GenerateTimelineService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/timeline/GenerateTimelineService.kt similarity index 90% rename from src/main/kotlin/dev/usbharu/hideout/service/post/GenerateTimelineService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/timeline/GenerateTimelineService.kt index 34f42678..7684a97f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/post/GenerateTimelineService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/timeline/GenerateTimelineService.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.post +package dev.usbharu.hideout.core.service.timeline import dev.usbharu.hideout.domain.mastodon.model.generated.Status import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/post/MongoGenerateTimelineService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/timeline/MongoGenerateTimelineService.kt similarity index 88% rename from src/main/kotlin/dev/usbharu/hideout/service/post/MongoGenerateTimelineService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/timeline/MongoGenerateTimelineService.kt index 1a75c9b0..f3accd56 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/post/MongoGenerateTimelineService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/timeline/MongoGenerateTimelineService.kt @@ -1,9 +1,9 @@ -package dev.usbharu.hideout.service.post +package dev.usbharu.hideout.core.service.timeline +import dev.usbharu.hideout.core.domain.model.timeline.Timeline import dev.usbharu.hideout.domain.mastodon.model.generated.Status -import dev.usbharu.hideout.domain.model.hideout.dto.StatusQuery -import dev.usbharu.hideout.domain.model.hideout.entity.Timeline -import dev.usbharu.hideout.query.mastodon.StatusQueryService +import dev.usbharu.hideout.mastodon.interfaces.api.status.StatusQuery +import dev.usbharu.hideout.mastodon.query.StatusQueryService import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.data.domain.Sort import org.springframework.data.mongodb.core.MongoTemplate diff --git a/src/main/kotlin/dev/usbharu/hideout/service/post/TimelineService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/timeline/TimelineService.kt similarity index 83% rename from src/main/kotlin/dev/usbharu/hideout/service/post/TimelineService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/timeline/TimelineService.kt index cdd3d94d..2b514508 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/post/TimelineService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/timeline/TimelineService.kt @@ -1,11 +1,11 @@ -package dev.usbharu.hideout.service.post +package dev.usbharu.hideout.core.service.timeline -import dev.usbharu.hideout.domain.model.hideout.entity.Post -import dev.usbharu.hideout.domain.model.hideout.entity.Timeline -import dev.usbharu.hideout.domain.model.hideout.entity.Visibility -import dev.usbharu.hideout.query.FollowerQueryService -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.repository.TimelineRepository +import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.domain.model.post.Visibility +import dev.usbharu.hideout.core.domain.model.timeline.Timeline +import dev.usbharu.hideout.core.domain.model.timeline.TimelineRepository +import dev.usbharu.hideout.core.query.FollowerQueryService +import dev.usbharu.hideout.core.query.UserQueryService import org.springframework.stereotype.Service @Service diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/RemoteUserCreateDto.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/user/RemoteUserCreateDto.kt similarity index 85% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/RemoteUserCreateDto.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/user/RemoteUserCreateDto.kt index 2a6a34fb..992956e3 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/RemoteUserCreateDto.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/user/RemoteUserCreateDto.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.hideout.dto +package dev.usbharu.hideout.core.service.user data class RemoteUserCreateDto( val name: String, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/user/UserAuthService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/user/UserAuthService.kt similarity index 85% rename from src/main/kotlin/dev/usbharu/hideout/service/user/UserAuthService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/user/UserAuthService.kt index 0028cdfb..80f4ae4b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/user/UserAuthService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/user/UserAuthService.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.service.user +package dev.usbharu.hideout.core.service.user import org.springframework.stereotype.Service import java.security.KeyPair diff --git a/src/main/kotlin/dev/usbharu/hideout/service/user/UserAuthServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/user/UserAuthServiceImpl.kt similarity index 93% rename from src/main/kotlin/dev/usbharu/hideout/service/user/UserAuthServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/user/UserAuthServiceImpl.kt index f6ca9424..1bb4599a 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/user/UserAuthServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/user/UserAuthServiceImpl.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.service.user +package dev.usbharu.hideout.core.service.user -import dev.usbharu.hideout.query.UserQueryService +import dev.usbharu.hideout.core.query.UserQueryService import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder import org.springframework.stereotype.Service import java.security.* diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/UserCreateDto.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/user/UserCreateDto.kt similarity index 71% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/UserCreateDto.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/user/UserCreateDto.kt index a57a8625..c9dd3d3b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/UserCreateDto.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/user/UserCreateDto.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.hideout.dto +package dev.usbharu.hideout.core.service.user data class UserCreateDto( val name: String, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/user/UserService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/user/UserService.kt similarity index 75% rename from src/main/kotlin/dev/usbharu/hideout/service/user/UserService.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/user/UserService.kt index 665d14f5..fdfb5bcf 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/user/UserService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/user/UserService.kt @@ -1,8 +1,6 @@ -package dev.usbharu.hideout.service.user +package dev.usbharu.hideout.core.service.user -import dev.usbharu.hideout.domain.model.hideout.dto.RemoteUserCreateDto -import dev.usbharu.hideout.domain.model.hideout.dto.UserCreateDto -import dev.usbharu.hideout.domain.model.hideout.entity.User +import dev.usbharu.hideout.core.domain.model.user.User import org.springframework.stereotype.Service @Suppress("TooManyFunctions") diff --git a/src/main/kotlin/dev/usbharu/hideout/service/user/UserServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/user/UserServiceImpl.kt similarity index 85% rename from src/main/kotlin/dev/usbharu/hideout/service/user/UserServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/core/service/user/UserServiceImpl.kt index 6688ce48..40df3646 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/user/UserServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/user/UserServiceImpl.kt @@ -1,15 +1,13 @@ -package dev.usbharu.hideout.service.user +package dev.usbharu.hideout.core.service.user -import dev.usbharu.hideout.config.ApplicationConfig -import dev.usbharu.hideout.domain.model.hideout.dto.RemoteUserCreateDto -import dev.usbharu.hideout.domain.model.hideout.dto.SendFollowDto -import dev.usbharu.hideout.domain.model.hideout.dto.UserCreateDto -import dev.usbharu.hideout.domain.model.hideout.entity.User -import dev.usbharu.hideout.exception.UserNotFoundException -import dev.usbharu.hideout.query.FollowerQueryService -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.repository.UserRepository -import dev.usbharu.hideout.service.ap.APSendFollowService +import dev.usbharu.hideout.activitypub.service.activity.follow.APSendFollowService +import dev.usbharu.hideout.application.config.ApplicationConfig +import dev.usbharu.hideout.core.domain.exception.UserNotFoundException +import dev.usbharu.hideout.core.domain.model.user.User +import dev.usbharu.hideout.core.domain.model.user.UserRepository +import dev.usbharu.hideout.core.query.FollowerQueryService +import dev.usbharu.hideout.core.query.UserQueryService +import dev.usbharu.hideout.core.service.follow.SendFollowDto import org.jetbrains.exposed.exceptions.ExposedSQLException import org.springframework.stereotype.Service import java.time.Instant diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/JwtToken.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/JwtToken.kt deleted file mode 100644 index 9c232f82..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/JwtToken.kt +++ /dev/null @@ -1,3 +0,0 @@ -package dev.usbharu.hideout.domain.model.hideout.dto - -data class JwtToken(val token: String, val refreshToken: String) diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/ReactionResponse.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/ReactionResponse.kt deleted file mode 100644 index 48f96165..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/ReactionResponse.kt +++ /dev/null @@ -1,10 +0,0 @@ -package dev.usbharu.hideout.domain.model.hideout.dto - -data class ReactionResponse( - val reaction: String, - val isUnicodeEmoji: Boolean = true, - val iconUrl: String, - val accounts: List -) - -data class Account(val screenName: String, val iconUrl: String, val url: String) diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/SendFollowDto.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/SendFollowDto.kt deleted file mode 100644 index 595bb695..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/SendFollowDto.kt +++ /dev/null @@ -1,5 +0,0 @@ -package dev.usbharu.hideout.domain.model.hideout.dto - -import dev.usbharu.hideout.domain.model.hideout.entity.User - -data class SendFollowDto(val userId: User, val followTargetUserId: User) diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/FollowRequest.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/FollowRequest.kt deleted file mode 100644 index b9769227..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/FollowRequest.kt +++ /dev/null @@ -1,3 +0,0 @@ -package dev.usbharu.hideout.domain.model.hideout.entity - -data class FollowRequest(val userId: Long, val followerId: Long) diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/JwtRefreshToken.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/JwtRefreshToken.kt deleted file mode 100644 index a7b54817..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/JwtRefreshToken.kt +++ /dev/null @@ -1,11 +0,0 @@ -package dev.usbharu.hideout.domain.model.hideout.entity - -import java.time.Instant - -data class JwtRefreshToken( - val id: Long, - val userId: Long, - val refreshToken: String, - val createdAt: Instant, - val expiresAt: Instant -) diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Meta.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Meta.kt deleted file mode 100644 index 770b04d1..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/Meta.kt +++ /dev/null @@ -1,3 +0,0 @@ -package dev.usbharu.hideout.domain.model.hideout.entity - -data class Meta(val version: String, val jwt: Jwt) diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/IllegalParameterException.kt b/src/main/kotlin/dev/usbharu/hideout/exception/IllegalParameterException.kt deleted file mode 100644 index fca3b79a..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/exception/IllegalParameterException.kt +++ /dev/null @@ -1,15 +0,0 @@ -package dev.usbharu.hideout.exception - -import java.io.Serial - -class IllegalParameterException : IllegalArgumentException { - constructor() : super() - constructor(s: String?) : super(s) - constructor(message: String?, cause: Throwable?) : super(message, cause) - constructor(cause: Throwable?) : super(cause) - - companion object { - @Serial - private const val serialVersionUID: Long = -4641102874061252642L - } -} diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/InvalidRefreshTokenException.kt b/src/main/kotlin/dev/usbharu/hideout/exception/InvalidRefreshTokenException.kt deleted file mode 100644 index c43b3a50..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/exception/InvalidRefreshTokenException.kt +++ /dev/null @@ -1,15 +0,0 @@ -package dev.usbharu.hideout.exception - -import java.io.Serial - -class InvalidRefreshTokenException : IllegalArgumentException { - constructor() : super() - constructor(s: String?) : super(s) - constructor(message: String?, cause: Throwable?) : super(message, cause) - constructor(cause: Throwable?) : super(cause) - - companion object { - @Serial - private const val serialVersionUID: Long = -3779633753651907145L - } -} diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/InvalidUsernameOrPasswordException.kt b/src/main/kotlin/dev/usbharu/hideout/exception/InvalidUsernameOrPasswordException.kt deleted file mode 100644 index 8dc0b4de..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/exception/InvalidUsernameOrPasswordException.kt +++ /dev/null @@ -1,15 +0,0 @@ -package dev.usbharu.hideout.exception - -import java.io.Serial - -class InvalidUsernameOrPasswordException : IllegalArgumentException { - constructor() : super() - constructor(s: String?) : super(s) - constructor(message: String?, cause: Throwable?) : super(message, cause) - constructor(cause: Throwable?) : super(cause) - - companion object { - @Serial - private const val serialVersionUID: Long = -3638699928983322003L - } -} diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/ParameterNotExistException.kt b/src/main/kotlin/dev/usbharu/hideout/exception/ParameterNotExistException.kt deleted file mode 100644 index 22649c7d..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/exception/ParameterNotExistException.kt +++ /dev/null @@ -1,15 +0,0 @@ -package dev.usbharu.hideout.exception - -import java.io.Serial - -class ParameterNotExistException : IllegalArgumentException { - constructor() : super() - constructor(s: String?) : super(s) - constructor(message: String?, cause: Throwable?) : super(message, cause) - constructor(cause: Throwable?) : super(cause) - - companion object { - @Serial - private const val serialVersionUID: Long = -8845602757225726432L - } -} diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/PostNotFoundException.kt b/src/main/kotlin/dev/usbharu/hideout/exception/PostNotFoundException.kt deleted file mode 100644 index 26104de6..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/exception/PostNotFoundException.kt +++ /dev/null @@ -1,15 +0,0 @@ -package dev.usbharu.hideout.exception - -import java.io.Serial - -class PostNotFoundException : IllegalArgumentException { - constructor() : super() - constructor(s: String?) : super(s) - constructor(message: String?, cause: Throwable?) : super(message, cause) - constructor(cause: Throwable?) : super(cause) - - companion object { - @Serial - private const val serialVersionUID: Long = 7133035286017262876L - } -} diff --git a/src/main/kotlin/dev/usbharu/hideout/exception/UsernameAlreadyExistException.kt b/src/main/kotlin/dev/usbharu/hideout/exception/UsernameAlreadyExistException.kt deleted file mode 100644 index d9661bd4..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/exception/UsernameAlreadyExistException.kt +++ /dev/null @@ -1,15 +0,0 @@ -package dev.usbharu.hideout.exception - -import java.io.Serial - -class UsernameAlreadyExistException : IllegalArgumentException { - constructor() : super() - constructor(s: String?) : super(s) - constructor(message: String?, cause: Throwable?) : super(message, cause) - constructor(cause: Throwable?) : super(cause) - - companion object { - @Serial - private const val serialVersionUID: Long = -4635016576575533883L - } -} diff --git a/src/main/kotlin/dev/usbharu/hideout/config/JsonOrFormBind.kt b/src/main/kotlin/dev/usbharu/hideout/generate/JsonOrFormBind.kt similarity index 78% rename from src/main/kotlin/dev/usbharu/hideout/config/JsonOrFormBind.kt rename to src/main/kotlin/dev/usbharu/hideout/generate/JsonOrFormBind.kt index 02ff8520..3fbf9c27 100644 --- a/src/main/kotlin/dev/usbharu/hideout/config/JsonOrFormBind.kt +++ b/src/main/kotlin/dev/usbharu/hideout/generate/JsonOrFormBind.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.config +package dev.usbharu.hideout.generate @MustBeDocumented @Retention(AnnotationRetention.RUNTIME) diff --git a/src/main/kotlin/dev/usbharu/hideout/config/JsonOrFormModelMethodProcessor.kt b/src/main/kotlin/dev/usbharu/hideout/generate/JsonOrFormModelMethodProcessor.kt similarity index 98% rename from src/main/kotlin/dev/usbharu/hideout/config/JsonOrFormModelMethodProcessor.kt rename to src/main/kotlin/dev/usbharu/hideout/generate/JsonOrFormModelMethodProcessor.kt index 6d1e7382..a4222880 100644 --- a/src/main/kotlin/dev/usbharu/hideout/config/JsonOrFormModelMethodProcessor.kt +++ b/src/main/kotlin/dev/usbharu/hideout/generate/JsonOrFormModelMethodProcessor.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.config +package dev.usbharu.hideout.generate import org.slf4j.LoggerFactory import org.springframework.core.MethodParameter diff --git a/src/main/kotlin/dev/usbharu/hideout/query/mastodon/StatusQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/StatusQueryServiceImpl.kt similarity index 95% rename from src/main/kotlin/dev/usbharu/hideout/query/mastodon/StatusQueryServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/StatusQueryServiceImpl.kt index cb058663..7589fcb6 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/mastodon/StatusQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/StatusQueryServiceImpl.kt @@ -1,11 +1,12 @@ -package dev.usbharu.hideout.query.mastodon +package dev.usbharu.hideout.mastodon.infrastructure.exposedquery +import dev.usbharu.hideout.core.infrastructure.exposedrepository.* +import dev.usbharu.hideout.core.service.media.FileType import dev.usbharu.hideout.domain.mastodon.model.generated.Account import dev.usbharu.hideout.domain.mastodon.model.generated.MediaAttachment import dev.usbharu.hideout.domain.mastodon.model.generated.Status -import dev.usbharu.hideout.domain.model.hideout.dto.FileType -import dev.usbharu.hideout.domain.model.hideout.dto.StatusQuery -import dev.usbharu.hideout.repository.* +import dev.usbharu.hideout.mastodon.interfaces.api.status.StatusQuery +import dev.usbharu.hideout.mastodon.query.StatusQueryService import org.jetbrains.exposed.sql.ResultRow import org.jetbrains.exposed.sql.innerJoin import org.jetbrains.exposed.sql.select @@ -60,7 +61,7 @@ class StatusQueryServiceImpl : StatusQueryService { @Suppress("unused") private suspend fun internalFindByPostIds(ids: List): List { val pairs = Posts - .innerJoin(Users, onColumn = { Posts.userId }, otherColumn = { id }) + .innerJoin(Users, onColumn = { Posts.userId }, otherColumn = { Users.id }) .select { Posts.id inList ids } .map { toStatus(it) to it[Posts.repostId] diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonAccountApiController.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/account/MastodonAccountApiController.kt similarity index 86% rename from src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonAccountApiController.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/account/MastodonAccountApiController.kt index 86ecc737..46a03fbe 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonAccountApiController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/account/MastodonAccountApiController.kt @@ -1,10 +1,10 @@ -package dev.usbharu.hideout.controller.mastodon +package dev.usbharu.hideout.mastodon.interfaces.api.account +import dev.usbharu.hideout.application.external.Transaction import dev.usbharu.hideout.controller.mastodon.generated.AccountApi +import dev.usbharu.hideout.core.service.user.UserCreateDto import dev.usbharu.hideout.domain.mastodon.model.generated.CredentialAccount -import dev.usbharu.hideout.domain.model.hideout.dto.UserCreateDto -import dev.usbharu.hideout.service.api.mastodon.AccountApiService -import dev.usbharu.hideout.service.core.Transaction +import dev.usbharu.hideout.mastodon.service.account.AccountApiService import org.springframework.http.HttpHeaders import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonAppsApiController.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/apps/MastodonAppsApiController.kt similarity index 92% rename from src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonAppsApiController.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/apps/MastodonAppsApiController.kt index 19eae835..3d3da82e 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonAppsApiController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/apps/MastodonAppsApiController.kt @@ -1,9 +1,9 @@ -package dev.usbharu.hideout.controller.mastodon +package dev.usbharu.hideout.mastodon.interfaces.api.apps import dev.usbharu.hideout.controller.mastodon.generated.AppApi import dev.usbharu.hideout.domain.mastodon.model.generated.Application import dev.usbharu.hideout.domain.mastodon.model.generated.AppsRequest -import dev.usbharu.hideout.service.api.mastodon.AppApiService +import dev.usbharu.hideout.mastodon.service.app.AppApiService import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity import org.springframework.stereotype.Controller diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonInstanceApiController.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/instance/MastodonInstanceApiController.kt similarity index 80% rename from src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonInstanceApiController.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/instance/MastodonInstanceApiController.kt index 5b2afba2..2ea5ed61 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonInstanceApiController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/instance/MastodonInstanceApiController.kt @@ -1,8 +1,8 @@ -package dev.usbharu.hideout.controller.mastodon +package dev.usbharu.hideout.mastodon.interfaces.api.instance import dev.usbharu.hideout.controller.mastodon.generated.InstanceApi import dev.usbharu.hideout.domain.mastodon.model.generated.V1Instance -import dev.usbharu.hideout.service.api.mastodon.InstanceApiService +import dev.usbharu.hideout.mastodon.service.instance.InstanceApiService import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity import org.springframework.stereotype.Controller diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonMediaApiController.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/media/MastodonMediaApiController.kt similarity index 81% rename from src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonMediaApiController.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/media/MastodonMediaApiController.kt index a7c9658e..8275cccb 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonMediaApiController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/media/MastodonMediaApiController.kt @@ -1,9 +1,8 @@ -package dev.usbharu.hideout.controller.mastodon +package dev.usbharu.hideout.mastodon.interfaces.api.media import dev.usbharu.hideout.controller.mastodon.generated.MediaApi import dev.usbharu.hideout.domain.mastodon.model.generated.MediaAttachment -import dev.usbharu.hideout.domain.model.hideout.form.Media -import dev.usbharu.hideout.service.api.mastodon.MediaApiService +import dev.usbharu.hideout.mastodon.service.media.MediaApiService import org.springframework.http.ResponseEntity import org.springframework.stereotype.Controller import org.springframework.web.multipart.MultipartFile @@ -18,7 +17,7 @@ class MastodonMediaApiController(private val mediaApiService: MediaApiService) : ): ResponseEntity { return ResponseEntity.ok( mediaApiService.postMedia( - Media( + MediaRequest( file, thumbnail, description, diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/form/Media.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/media/MediaRequest.kt similarity index 67% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/form/Media.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/media/MediaRequest.kt index 978eaa56..c8c1826b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/form/Media.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/media/MediaRequest.kt @@ -1,8 +1,8 @@ -package dev.usbharu.hideout.domain.model.hideout.form +package dev.usbharu.hideout.mastodon.interfaces.api.media import org.springframework.web.multipart.MultipartFile -data class Media( +data class MediaRequest( val file: MultipartFile, val thumbnail: MultipartFile?, val description: String?, diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonStatusesApiContoller.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/MastodonStatusesApiContoller.kt similarity index 84% rename from src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonStatusesApiContoller.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/MastodonStatusesApiContoller.kt index 02737c71..2b2e65eb 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonStatusesApiContoller.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/MastodonStatusesApiContoller.kt @@ -1,9 +1,8 @@ -package dev.usbharu.hideout.controller.mastodon +package dev.usbharu.hideout.mastodon.interfaces.api.status import dev.usbharu.hideout.controller.mastodon.generated.StatusApi import dev.usbharu.hideout.domain.mastodon.model.generated.Status -import dev.usbharu.hideout.domain.model.mastodon.StatusesRequest -import dev.usbharu.hideout.service.api.mastodon.StatusesApiService +import dev.usbharu.hideout.mastodon.service.status.StatusesApiService import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity import org.springframework.security.core.context.SecurityContextHolder diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/StatusQuery.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/StatusQuery.kt similarity index 68% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/StatusQuery.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/StatusQuery.kt index cba8477b..ea5c1517 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/StatusQuery.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/StatusQuery.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.hideout.dto +package dev.usbharu.hideout.mastodon.interfaces.api.status data class StatusQuery( val postId: Long, diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/mastodon/StatusesRequest.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/StatusesRequest.kt similarity index 97% rename from src/main/kotlin/dev/usbharu/hideout/domain/model/mastodon/StatusesRequest.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/StatusesRequest.kt index 10eb380e..715a6819 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/mastodon/StatusesRequest.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/StatusesRequest.kt @@ -1,4 +1,4 @@ -package dev.usbharu.hideout.domain.model.mastodon +package dev.usbharu.hideout.mastodon.interfaces.api.status import com.fasterxml.jackson.annotation.JsonProperty import dev.usbharu.hideout.domain.mastodon.model.generated.StatusesRequestPoll diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonTimelineApiController.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/timeline/MastodonTimelineApiController.kt similarity index 93% rename from src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonTimelineApiController.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/timeline/MastodonTimelineApiController.kt index 26a5c392..41316f1e 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonTimelineApiController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/timeline/MastodonTimelineApiController.kt @@ -1,8 +1,8 @@ -package dev.usbharu.hideout.controller.mastodon +package dev.usbharu.hideout.mastodon.interfaces.api.timeline import dev.usbharu.hideout.controller.mastodon.generated.TimelineApi import dev.usbharu.hideout.domain.mastodon.model.generated.Status -import dev.usbharu.hideout.service.api.mastodon.TimelineApiService +import dev.usbharu.hideout.mastodon.service.timeline.TimelineApiService import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.runBlocking diff --git a/src/main/kotlin/dev/usbharu/hideout/query/mastodon/StatusQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/query/StatusQueryService.kt similarity index 69% rename from src/main/kotlin/dev/usbharu/hideout/query/mastodon/StatusQueryService.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/query/StatusQueryService.kt index fbceccc7..a5777360 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/mastodon/StatusQueryService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/query/StatusQueryService.kt @@ -1,7 +1,7 @@ -package dev.usbharu.hideout.query.mastodon +package dev.usbharu.hideout.mastodon.query import dev.usbharu.hideout.domain.mastodon.model.generated.Status -import dev.usbharu.hideout.domain.model.hideout.dto.StatusQuery +import dev.usbharu.hideout.mastodon.interfaces.api.status.StatusQuery interface StatusQueryService { suspend fun findByPostIds(ids: List): List diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/AccountApiService.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/account/AccountApiService.kt similarity index 89% rename from src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/AccountApiService.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/service/account/AccountApiService.kt index 2eece508..9fc44262 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/AccountApiService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/account/AccountApiService.kt @@ -1,13 +1,12 @@ -package dev.usbharu.hideout.service.api.mastodon +package dev.usbharu.hideout.mastodon.service.account +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.service.user.UserCreateDto +import dev.usbharu.hideout.core.service.user.UserService import dev.usbharu.hideout.domain.mastodon.model.generated.Account import dev.usbharu.hideout.domain.mastodon.model.generated.CredentialAccount import dev.usbharu.hideout.domain.mastodon.model.generated.CredentialAccountSource import dev.usbharu.hideout.domain.mastodon.model.generated.Role -import dev.usbharu.hideout.domain.model.hideout.dto.UserCreateDto -import dev.usbharu.hideout.service.core.Transaction -import dev.usbharu.hideout.service.mastodon.AccountService -import dev.usbharu.hideout.service.user.UserService import org.springframework.stereotype.Service @Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/mastodon/AccountService.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/account/AccountService.kt similarity index 92% rename from src/main/kotlin/dev/usbharu/hideout/service/mastodon/AccountService.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/service/account/AccountService.kt index d4f7d97a..a7f5f766 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/mastodon/AccountService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/account/AccountService.kt @@ -1,7 +1,7 @@ -package dev.usbharu.hideout.service.mastodon +package dev.usbharu.hideout.mastodon.service.account +import dev.usbharu.hideout.core.query.UserQueryService import dev.usbharu.hideout.domain.mastodon.model.generated.Account -import dev.usbharu.hideout.query.UserQueryService import org.springframework.stereotype.Service @Service diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/AppApiService.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/app/AppApiService.kt similarity index 93% rename from src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/AppApiService.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/service/app/AppApiService.kt index 6d1cb252..6d7d463e 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/AppApiService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/app/AppApiService.kt @@ -1,9 +1,9 @@ -package dev.usbharu.hideout.service.api.mastodon +package dev.usbharu.hideout.mastodon.service.app +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.infrastructure.springframework.oauth2.SecureTokenGenerator import dev.usbharu.hideout.domain.mastodon.model.generated.Application import dev.usbharu.hideout.domain.mastodon.model.generated.AppsRequest -import dev.usbharu.hideout.service.auth.SecureTokenGenerator -import dev.usbharu.hideout.service.core.Transaction import org.springframework.security.crypto.password.PasswordEncoder import org.springframework.security.oauth2.core.AuthorizationGrantType import org.springframework.security.oauth2.core.ClientAuthenticationMethod diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/InstanceApiService.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/instance/InstanceApiService.kt similarity index 95% rename from src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/InstanceApiService.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/service/instance/InstanceApiService.kt index 00537012..2abc1169 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/InstanceApiService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/instance/InstanceApiService.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.service.api.mastodon +package dev.usbharu.hideout.mastodon.service.instance -import dev.usbharu.hideout.config.ApplicationConfig +import dev.usbharu.hideout.application.config.ApplicationConfig import dev.usbharu.hideout.domain.mastodon.model.generated.* import org.springframework.stereotype.Service diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/service/media/MediaApiService.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/media/MediaApiService.kt new file mode 100644 index 00000000..0da1d222 --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/media/MediaApiService.kt @@ -0,0 +1,10 @@ +package dev.usbharu.hideout.mastodon.service.media + +import dev.usbharu.hideout.domain.mastodon.model.generated.MediaAttachment +import dev.usbharu.hideout.mastodon.interfaces.api.media.MediaRequest +import org.springframework.stereotype.Service + +@Service +interface MediaApiService { + suspend fun postMedia(mediaRequest: MediaRequest): MediaAttachment +} diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/MediaApiServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/media/MediaApiServiceImpl.kt similarity index 70% rename from src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/MediaApiServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/service/media/MediaApiServiceImpl.kt index ab4d07de..824a6f59 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/MediaApiServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/media/MediaApiServiceImpl.kt @@ -1,19 +1,19 @@ -package dev.usbharu.hideout.service.api.mastodon +package dev.usbharu.hideout.mastodon.service.media +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.service.media.FileType +import dev.usbharu.hideout.core.service.media.MediaService import dev.usbharu.hideout.domain.mastodon.model.generated.MediaAttachment -import dev.usbharu.hideout.domain.model.hideout.dto.FileType -import dev.usbharu.hideout.domain.model.hideout.form.Media -import dev.usbharu.hideout.service.core.Transaction -import dev.usbharu.hideout.service.media.MediaService +import dev.usbharu.hideout.mastodon.interfaces.api.media.MediaRequest import org.springframework.stereotype.Service @Service class MediaApiServiceImpl(private val mediaService: MediaService, private val transaction: Transaction) : MediaApiService { - override suspend fun postMedia(media: Media): MediaAttachment { + override suspend fun postMedia(mediaRequest: MediaRequest): MediaAttachment { return transaction.transaction { - val uploadLocalMedia = mediaService.uploadLocalMedia(media) + val uploadLocalMedia = mediaService.uploadLocalMedia(mediaRequest) val type = when (uploadLocalMedia.type) { FileType.Image -> MediaAttachment.Type.image FileType.Video -> MediaAttachment.Type.video @@ -26,7 +26,7 @@ class MediaApiServiceImpl(private val mediaService: MediaService, private val tr url = uploadLocalMedia.url, previewUrl = uploadLocalMedia.thumbnailUrl, remoteUrl = null, - description = media.description, + description = mediaRequest.description, blurhash = uploadLocalMedia.blurHash, textUrl = uploadLocalMedia.url ) diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/StatusesApiService.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/status/StatusesApiService.kt similarity index 82% rename from src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/StatusesApiService.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/service/status/StatusesApiService.kt index 2baae425..1cc448e0 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/StatusesApiService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/status/StatusesApiService.kt @@ -1,25 +1,25 @@ -package dev.usbharu.hideout.service.api.mastodon +package dev.usbharu.hideout.mastodon.service.status +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.domain.exception.FailedToGetResourcesException +import dev.usbharu.hideout.core.domain.model.media.MediaRepository +import dev.usbharu.hideout.core.domain.model.post.Visibility +import dev.usbharu.hideout.core.query.PostQueryService +import dev.usbharu.hideout.core.query.UserQueryService +import dev.usbharu.hideout.core.service.media.FileType +import dev.usbharu.hideout.core.service.post.PostCreateDto +import dev.usbharu.hideout.core.service.post.PostService import dev.usbharu.hideout.domain.mastodon.model.generated.MediaAttachment import dev.usbharu.hideout.domain.mastodon.model.generated.Status -import dev.usbharu.hideout.domain.model.hideout.dto.FileType -import dev.usbharu.hideout.domain.model.hideout.dto.PostCreateDto -import dev.usbharu.hideout.domain.model.hideout.entity.Visibility -import dev.usbharu.hideout.domain.model.mastodon.StatusesRequest -import dev.usbharu.hideout.exception.FailedToGetResourcesException -import dev.usbharu.hideout.query.PostQueryService -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.repository.MediaRepository -import dev.usbharu.hideout.service.core.Transaction -import dev.usbharu.hideout.service.mastodon.AccountService -import dev.usbharu.hideout.service.post.PostService +import dev.usbharu.hideout.mastodon.interfaces.api.status.StatusesRequest +import dev.usbharu.hideout.mastodon.service.account.AccountService import org.springframework.stereotype.Service import java.time.Instant @Service interface StatusesApiService { suspend fun postStatus( - statusesRequest: dev.usbharu.hideout.domain.model.mastodon.StatusesRequest, + statusesRequest: StatusesRequest, userId: Long ): Status } @@ -36,7 +36,7 @@ class StatsesApiServiceImpl( StatusesApiService { @Suppress("LongMethod", "CyclomaticComplexMethod") override suspend fun postStatus( - statusesRequest: dev.usbharu.hideout.domain.model.mastodon.StatusesRequest, + statusesRequest: StatusesRequest, userId: Long ): Status = transaction.transaction { val visibility = when (statusesRequest.visibility) { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/TimelineApiService.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/timeline/TimelineApiService.kt similarity index 90% rename from src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/TimelineApiService.kt rename to src/main/kotlin/dev/usbharu/hideout/mastodon/service/timeline/TimelineApiService.kt index 7f2a39e4..29fb0e7b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/TimelineApiService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/timeline/TimelineApiService.kt @@ -1,8 +1,8 @@ -package dev.usbharu.hideout.service.api.mastodon +package dev.usbharu.hideout.mastodon.service.timeline +import dev.usbharu.hideout.application.external.Transaction +import dev.usbharu.hideout.core.service.timeline.GenerateTimelineService import dev.usbharu.hideout.domain.mastodon.model.generated.Status -import dev.usbharu.hideout.service.core.Transaction -import dev.usbharu.hideout.service.post.GenerateTimelineService import org.springframework.stereotype.Service @Suppress("LongParameterList") diff --git a/src/main/kotlin/dev/usbharu/hideout/query/JwtRefreshTokenQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/query/JwtRefreshTokenQueryService.kt deleted file mode 100644 index 44c5675c..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/query/JwtRefreshTokenQueryService.kt +++ /dev/null @@ -1,15 +0,0 @@ -package dev.usbharu.hideout.query - -import dev.usbharu.hideout.domain.model.hideout.entity.JwtRefreshToken -import org.springframework.stereotype.Repository - -@Repository -interface JwtRefreshTokenQueryService { - suspend fun findById(id: Long): JwtRefreshToken - suspend fun findByToken(token: String): JwtRefreshToken - suspend fun findByUserId(userId: Long): JwtRefreshToken - suspend fun deleteById(id: Long) - suspend fun deleteByToken(token: String) - suspend fun deleteByUserId(userId: Long) - suspend fun deleteAll() -} diff --git a/src/main/kotlin/dev/usbharu/hideout/query/MediaQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/query/MediaQueryService.kt deleted file mode 100644 index 183e808f..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/query/MediaQueryService.kt +++ /dev/null @@ -1,7 +0,0 @@ -package dev.usbharu.hideout.query - -import dev.usbharu.hideout.domain.model.hideout.entity.Media - -interface MediaQueryService { - suspend fun findByPostId(postId: Long): List -} diff --git a/src/main/kotlin/dev/usbharu/hideout/query/MediaQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/query/MediaQueryServiceImpl.kt deleted file mode 100644 index ecb687bb..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/query/MediaQueryServiceImpl.kt +++ /dev/null @@ -1,17 +0,0 @@ -package dev.usbharu.hideout.query - -import dev.usbharu.hideout.domain.model.hideout.entity.Media -import dev.usbharu.hideout.repository.PostsMedia -import dev.usbharu.hideout.repository.toMedia -import org.jetbrains.exposed.sql.innerJoin -import org.jetbrains.exposed.sql.select -import org.springframework.stereotype.Repository - -@Repository -class MediaQueryServiceImpl : MediaQueryService { - override suspend fun findByPostId(postId: Long): List { - return dev.usbharu.hideout.repository.Media.innerJoin(PostsMedia, onColumn = { id }, otherColumn = { mediaId }) - .select { PostsMedia.postId eq postId } - .map { it.toMedia() } - } -} diff --git a/src/main/kotlin/dev/usbharu/hideout/query/activitypub/NoteQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/query/activitypub/NoteQueryService.kt deleted file mode 100644 index d0ee3adb..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/query/activitypub/NoteQueryService.kt +++ /dev/null @@ -1,8 +0,0 @@ -package dev.usbharu.hideout.query.activitypub - -import dev.usbharu.hideout.domain.model.ap.Note -import dev.usbharu.hideout.domain.model.hideout.entity.Post - -interface NoteQueryService { - suspend fun findById(id: Long): Pair -} diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/NoteApApiService.kt b/src/main/kotlin/dev/usbharu/hideout/service/api/NoteApApiService.kt deleted file mode 100644 index 38006f4b..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/NoteApApiService.kt +++ /dev/null @@ -1,7 +0,0 @@ -package dev.usbharu.hideout.service.api - -import dev.usbharu.hideout.domain.model.ap.Note - -interface NoteApApiService { - suspend fun getNote(postId: Long, userId: Long?): Note? -} diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/MediaApiService.kt b/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/MediaApiService.kt deleted file mode 100644 index 8b1da1b9..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/mastodon/MediaApiService.kt +++ /dev/null @@ -1,10 +0,0 @@ -package dev.usbharu.hideout.service.api.mastodon - -import dev.usbharu.hideout.domain.mastodon.model.generated.MediaAttachment -import dev.usbharu.hideout.domain.model.hideout.form.Media -import org.springframework.stereotype.Service - -@Service -interface MediaApiService { - suspend fun postMedia(media: Media): MediaAttachment -} diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/MediaDataStore.kt b/src/main/kotlin/dev/usbharu/hideout/service/media/MediaDataStore.kt deleted file mode 100644 index bd03f704..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/MediaDataStore.kt +++ /dev/null @@ -1,9 +0,0 @@ -package dev.usbharu.hideout.service.media - -import dev.usbharu.hideout.domain.model.MediaSave -import dev.usbharu.hideout.domain.model.hideout.dto.SavedMedia - -interface MediaDataStore { - suspend fun save(dataMediaSave: MediaSave): SavedMedia - suspend fun delete(id: String) -} diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/MediaService.kt b/src/main/kotlin/dev/usbharu/hideout/service/media/MediaService.kt deleted file mode 100644 index 025b22ad..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/MediaService.kt +++ /dev/null @@ -1,9 +0,0 @@ -package dev.usbharu.hideout.service.media - -import dev.usbharu.hideout.domain.model.hideout.dto.RemoteMedia -import dev.usbharu.hideout.domain.model.hideout.form.Media - -interface MediaService { - suspend fun uploadLocalMedia(media: Media): dev.usbharu.hideout.domain.model.hideout.entity.Media - suspend fun uploadRemoteMedia(remoteMedia: RemoteMedia) -} diff --git a/src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaConverter.kt b/src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaConverter.kt deleted file mode 100644 index 0829ac46..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/service/media/converter/MediaConverter.kt +++ /dev/null @@ -1,10 +0,0 @@ -package dev.usbharu.hideout.service.media.converter - -import dev.usbharu.hideout.domain.model.hideout.dto.FileType -import dev.usbharu.hideout.domain.model.hideout.dto.ProcessedFile -import java.io.InputStream - -interface MediaConverter { - fun isSupport(fileType: FileType): Boolean - fun convert(inputStream: InputStream): ProcessedFile -} diff --git a/src/main/kotlin/dev/usbharu/hideout/util/AcctUtil.kt b/src/main/kotlin/dev/usbharu/hideout/util/AcctUtil.kt index 34ab88ba..d8e7b246 100644 --- a/src/main/kotlin/dev/usbharu/hideout/util/AcctUtil.kt +++ b/src/main/kotlin/dev/usbharu/hideout/util/AcctUtil.kt @@ -1,6 +1,6 @@ package dev.usbharu.hideout.util -import dev.usbharu.hideout.domain.model.Acct +import dev.usbharu.hideout.core.domain.model.user.Acct object AcctUtil { fun parse(string: String): Acct { diff --git a/src/test/kotlin/dev/usbharu/hideout/ap/ContextDeserializerTest.kt b/src/test/kotlin/dev/usbharu/hideout/ap/ContextDeserializerTest.kt index fd9f7d9c..dfb64b4d 100644 --- a/src/test/kotlin/dev/usbharu/hideout/ap/ContextDeserializerTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/ap/ContextDeserializerTest.kt @@ -3,7 +3,7 @@ package dev.usbharu.hideout.ap import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.readValue -import dev.usbharu.hideout.domain.model.ap.Follow +import dev.usbharu.hideout.activitypub.domain.model.Follow class ContextDeserializerTest { diff --git a/src/test/kotlin/dev/usbharu/hideout/ap/ContextSerializerTest.kt b/src/test/kotlin/dev/usbharu/hideout/ap/ContextSerializerTest.kt index 9a6013e2..db434005 100644 --- a/src/test/kotlin/dev/usbharu/hideout/ap/ContextSerializerTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/ap/ContextSerializerTest.kt @@ -1,8 +1,8 @@ package dev.usbharu.hideout.ap import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper -import dev.usbharu.hideout.domain.model.ap.Accept -import dev.usbharu.hideout.domain.model.ap.Follow +import dev.usbharu.hideout.activitypub.domain.model.Accept +import dev.usbharu.hideout.activitypub.domain.model.Follow import org.junit.jupiter.api.Test class ContextSerializerTest { diff --git a/src/test/kotlin/dev/usbharu/hideout/domain/model/ap/UndoTest.kt b/src/test/kotlin/dev/usbharu/hideout/domain/model/ap/UndoTest.kt index cc02183e..eb9a1f9e 100644 --- a/src/test/kotlin/dev/usbharu/hideout/domain/model/ap/UndoTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/domain/model/ap/UndoTest.kt @@ -1,7 +1,8 @@ package dev.usbharu.hideout.domain.model.ap +import dev.usbharu.hideout.activitypub.domain.model.Follow +import dev.usbharu.hideout.activitypub.domain.model.Undo import org.intellij.lang.annotations.Language -import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Test import utils.JsonObjectMapper import java.time.Clock diff --git a/src/test/kotlin/dev/usbharu/hideout/service/ap/APAcceptServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/ap/APAcceptServiceImplTest.kt index e4f0a851..14e8154f 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/ap/APAcceptServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/ap/APAcceptServiceImplTest.kt @@ -1,13 +1,14 @@ package dev.usbharu.hideout.service.ap -import dev.usbharu.hideout.domain.model.ActivityPubStringResponse -import dev.usbharu.hideout.domain.model.ap.Accept -import dev.usbharu.hideout.domain.model.ap.Follow -import dev.usbharu.hideout.domain.model.ap.Like -import dev.usbharu.hideout.exception.ap.IllegalActivityPubObjectException -import dev.usbharu.hideout.query.FollowerQueryService -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.service.user.UserService +import dev.usbharu.hideout.activitypub.domain.exception.IllegalActivityPubObjectException +import dev.usbharu.hideout.activitypub.domain.model.Accept +import dev.usbharu.hideout.activitypub.domain.model.Follow +import dev.usbharu.hideout.activitypub.domain.model.Like +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubStringResponse +import dev.usbharu.hideout.activitypub.service.activity.accept.APAcceptServiceImpl +import dev.usbharu.hideout.core.query.FollowerQueryService +import dev.usbharu.hideout.core.query.UserQueryService +import dev.usbharu.hideout.core.service.user.UserService import io.ktor.http.* import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals diff --git a/src/test/kotlin/dev/usbharu/hideout/service/ap/APCreateServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/ap/APCreateServiceImplTest.kt index 0d3acf72..ee0889fc 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/ap/APCreateServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/ap/APCreateServiceImplTest.kt @@ -1,10 +1,12 @@ package dev.usbharu.hideout.service.ap -import dev.usbharu.hideout.domain.model.ActivityPubStringResponse -import dev.usbharu.hideout.domain.model.ap.Create -import dev.usbharu.hideout.domain.model.ap.Like -import dev.usbharu.hideout.domain.model.ap.Note -import dev.usbharu.hideout.exception.ap.IllegalActivityPubObjectException +import dev.usbharu.hideout.activitypub.domain.exception.IllegalActivityPubObjectException +import dev.usbharu.hideout.activitypub.domain.model.Create +import dev.usbharu.hideout.activitypub.domain.model.Like +import dev.usbharu.hideout.activitypub.domain.model.Note +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubStringResponse +import dev.usbharu.hideout.activitypub.service.activity.create.APCreateServiceImpl +import dev.usbharu.hideout.activitypub.service.`object`.note.APNoteService import io.ktor.http.* import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals diff --git a/src/test/kotlin/dev/usbharu/hideout/service/ap/APLikeServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/ap/APLikeServiceImplTest.kt index 88140695..17ad28f3 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/ap/APLikeServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/ap/APLikeServiceImplTest.kt @@ -1,12 +1,15 @@ package dev.usbharu.hideout.service.ap -import dev.usbharu.hideout.domain.model.ActivityPubStringResponse -import dev.usbharu.hideout.domain.model.ap.Like -import dev.usbharu.hideout.domain.model.ap.Note -import dev.usbharu.hideout.domain.model.ap.Person -import dev.usbharu.hideout.exception.ap.FailedToGetActivityPubResourceException -import dev.usbharu.hideout.query.PostQueryService -import dev.usbharu.hideout.service.reaction.ReactionService +import dev.usbharu.hideout.activitypub.domain.exception.FailedToGetActivityPubResourceException +import dev.usbharu.hideout.activitypub.domain.model.Like +import dev.usbharu.hideout.activitypub.domain.model.Note +import dev.usbharu.hideout.activitypub.domain.model.Person +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubStringResponse +import dev.usbharu.hideout.activitypub.service.activity.like.APLikeServiceImpl +import dev.usbharu.hideout.activitypub.service.`object`.note.APNoteService +import dev.usbharu.hideout.activitypub.service.`object`.user.APUserService +import dev.usbharu.hideout.core.query.PostQueryService +import dev.usbharu.hideout.core.service.reaction.ReactionService import io.ktor.http.* import kotlinx.coroutines.async import kotlinx.coroutines.test.runTest diff --git a/src/test/kotlin/dev/usbharu/hideout/service/ap/APNoteServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/ap/APNoteServiceImplTest.kt index 1c8bf1f6..03ee3d48 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/ap/APNoteServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/ap/APNoteServiceImplTest.kt @@ -2,29 +2,31 @@ package dev.usbharu.hideout.service.ap -import dev.usbharu.hideout.config.ApplicationConfig -import dev.usbharu.hideout.config.CharacterLimit -import dev.usbharu.hideout.domain.model.ap.Image -import dev.usbharu.hideout.domain.model.ap.Key -import dev.usbharu.hideout.domain.model.ap.Note -import dev.usbharu.hideout.domain.model.ap.Person -import dev.usbharu.hideout.domain.model.hideout.entity.Post -import dev.usbharu.hideout.domain.model.hideout.entity.User -import dev.usbharu.hideout.domain.model.hideout.entity.Visibility -import dev.usbharu.hideout.domain.model.job.DeliverPostJob -import dev.usbharu.hideout.exception.FailedToGetResourcesException -import dev.usbharu.hideout.exception.ap.FailedToGetActivityPubResourceException -import dev.usbharu.hideout.query.FollowerQueryService -import dev.usbharu.hideout.query.MediaQueryService -import dev.usbharu.hideout.query.PostQueryService -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.repository.PostRepository -import dev.usbharu.hideout.service.ap.APNoteServiceImpl.Companion.public -import dev.usbharu.hideout.service.ap.job.ApNoteJobServiceImpl -import dev.usbharu.hideout.service.ap.resource.APResourceResolveService -import dev.usbharu.hideout.service.core.TwitterSnowflakeIdGenerateService -import dev.usbharu.hideout.service.job.JobQueueParentService -import dev.usbharu.hideout.service.post.PostService +import dev.usbharu.hideout.activitypub.domain.exception.FailedToGetActivityPubResourceException +import dev.usbharu.hideout.activitypub.domain.model.Image +import dev.usbharu.hideout.activitypub.domain.model.Key +import dev.usbharu.hideout.activitypub.domain.model.Note +import dev.usbharu.hideout.activitypub.domain.model.Person +import dev.usbharu.hideout.activitypub.service.common.APResourceResolveService +import dev.usbharu.hideout.activitypub.service.`object`.note.APNoteServiceImpl +import dev.usbharu.hideout.activitypub.service.`object`.note.APNoteServiceImpl.Companion.public +import dev.usbharu.hideout.activitypub.service.`object`.note.ApNoteJobServiceImpl +import dev.usbharu.hideout.activitypub.service.`object`.user.APUserService +import dev.usbharu.hideout.application.config.ApplicationConfig +import dev.usbharu.hideout.application.config.CharacterLimit +import dev.usbharu.hideout.application.service.id.TwitterSnowflakeIdGenerateService +import dev.usbharu.hideout.core.domain.exception.FailedToGetResourcesException +import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.domain.model.post.PostRepository +import dev.usbharu.hideout.core.domain.model.post.Visibility +import dev.usbharu.hideout.core.domain.model.user.User +import dev.usbharu.hideout.core.external.job.DeliverPostJob +import dev.usbharu.hideout.core.query.FollowerQueryService +import dev.usbharu.hideout.core.query.MediaQueryService +import dev.usbharu.hideout.core.query.PostQueryService +import dev.usbharu.hideout.core.query.UserQueryService +import dev.usbharu.hideout.core.service.job.JobQueueParentService +import dev.usbharu.hideout.core.service.post.PostService import io.ktor.client.* import io.ktor.client.call.* import io.ktor.client.plugins.* diff --git a/src/test/kotlin/dev/usbharu/hideout/service/ap/APReactionServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/ap/APReactionServiceImplTest.kt index d0a89b23..c95ff088 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/ap/APReactionServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/ap/APReactionServiceImplTest.kt @@ -1,13 +1,14 @@ package dev.usbharu.hideout.service.ap -import dev.usbharu.hideout.domain.model.hideout.entity.Reaction -import dev.usbharu.hideout.domain.model.job.DeliverReactionJob -import dev.usbharu.hideout.domain.model.job.DeliverRemoveReactionJob -import dev.usbharu.hideout.query.FollowerQueryService -import dev.usbharu.hideout.query.PostQueryService -import dev.usbharu.hideout.service.core.TwitterSnowflakeIdGenerateService -import dev.usbharu.hideout.service.job.JobQueueParentService +import dev.usbharu.hideout.activitypub.service.activity.like.APReactionServiceImpl +import dev.usbharu.hideout.application.service.id.TwitterSnowflakeIdGenerateService +import dev.usbharu.hideout.core.domain.model.reaction.Reaction +import dev.usbharu.hideout.core.external.job.DeliverReactionJob +import dev.usbharu.hideout.core.external.job.DeliverRemoveReactionJob +import dev.usbharu.hideout.core.query.FollowerQueryService +import dev.usbharu.hideout.core.query.PostQueryService +import dev.usbharu.hideout.core.service.job.JobQueueParentService import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Test import org.mockito.kotlin.* diff --git a/src/test/kotlin/dev/usbharu/hideout/service/ap/APReceiveFollowServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/ap/APReceiveFollowServiceImplTest.kt index f13981e1..77df2f55 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/ap/APReceiveFollowServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/ap/APReceiveFollowServiceImplTest.kt @@ -3,19 +3,21 @@ package dev.usbharu.hideout.service.ap -import dev.usbharu.hideout.config.ApplicationConfig -import dev.usbharu.hideout.config.CharacterLimit -import dev.usbharu.hideout.domain.model.ap.Follow -import dev.usbharu.hideout.domain.model.ap.Image -import dev.usbharu.hideout.domain.model.ap.Key -import dev.usbharu.hideout.domain.model.ap.Person -import dev.usbharu.hideout.domain.model.hideout.entity.Post -import dev.usbharu.hideout.domain.model.hideout.entity.User -import dev.usbharu.hideout.domain.model.job.ReceiveFollowJob -import dev.usbharu.hideout.query.UserQueryService -import dev.usbharu.hideout.service.ap.job.APReceiveFollowJobServiceImpl -import dev.usbharu.hideout.service.job.JobQueueParentService -import dev.usbharu.hideout.service.user.UserService +import dev.usbharu.hideout.activitypub.domain.model.Follow +import dev.usbharu.hideout.activitypub.domain.model.Image +import dev.usbharu.hideout.activitypub.domain.model.Key +import dev.usbharu.hideout.activitypub.domain.model.Person +import dev.usbharu.hideout.activitypub.service.activity.follow.APReceiveFollowJobServiceImpl +import dev.usbharu.hideout.activitypub.service.activity.follow.APReceiveFollowServiceImpl +import dev.usbharu.hideout.activitypub.service.`object`.user.APUserService +import dev.usbharu.hideout.application.config.ApplicationConfig +import dev.usbharu.hideout.application.config.CharacterLimit +import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.domain.model.user.User +import dev.usbharu.hideout.core.external.job.ReceiveFollowJob +import dev.usbharu.hideout.core.query.UserQueryService +import dev.usbharu.hideout.core.service.job.JobQueueParentService +import dev.usbharu.hideout.core.service.user.UserService import kjob.core.dsl.ScheduleContext import kjob.core.job.JobProps import kotlinx.coroutines.ExperimentalCoroutinesApi diff --git a/src/test/kotlin/dev/usbharu/hideout/service/ap/APRequestServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/ap/APRequestServiceImplTest.kt index 3d77a924..a8cdd101 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/ap/APRequestServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/ap/APRequestServiceImplTest.kt @@ -1,7 +1,8 @@ package dev.usbharu.hideout.service.ap import com.fasterxml.jackson.module.kotlin.readValue -import dev.usbharu.hideout.domain.model.ap.Follow +import dev.usbharu.hideout.activitypub.domain.model.Follow +import dev.usbharu.hideout.activitypub.service.common.APRequestServiceImpl import dev.usbharu.hideout.util.Base64Util import dev.usbharu.httpsignature.common.HttpHeaders import dev.usbharu.httpsignature.common.HttpMethod diff --git a/src/test/kotlin/dev/usbharu/hideout/service/ap/APSendFollowServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/ap/APSendFollowServiceImplTest.kt index 30d9b362..f6b6ce3c 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/ap/APSendFollowServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/ap/APSendFollowServiceImplTest.kt @@ -1,7 +1,9 @@ package dev.usbharu.hideout.service.ap -import dev.usbharu.hideout.domain.model.ap.Follow -import dev.usbharu.hideout.domain.model.hideout.dto.SendFollowDto +import dev.usbharu.hideout.activitypub.domain.model.Follow +import dev.usbharu.hideout.activitypub.service.activity.follow.APSendFollowServiceImpl +import dev.usbharu.hideout.activitypub.service.common.APRequestService +import dev.usbharu.hideout.core.service.follow.SendFollowDto import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Test import org.mockito.kotlin.eq diff --git a/src/test/kotlin/dev/usbharu/hideout/service/ap/APServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/ap/APServiceImplTest.kt index e96cc491..ac8ebb99 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/ap/APServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/ap/APServiceImplTest.kt @@ -1,6 +1,8 @@ package dev.usbharu.hideout.service.ap -import dev.usbharu.hideout.exception.JsonParseException +import dev.usbharu.hideout.activitypub.domain.exception.JsonParseException +import dev.usbharu.hideout.activitypub.service.common.APServiceImpl +import dev.usbharu.hideout.activitypub.service.common.ActivityType import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import org.mockito.kotlin.mock diff --git a/src/test/kotlin/dev/usbharu/hideout/service/ap/APUndoServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/ap/APUndoServiceImplTest.kt index 3eb01c14..49e91303 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/ap/APUndoServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/ap/APUndoServiceImplTest.kt @@ -1,9 +1,10 @@ package dev.usbharu.hideout.service.ap -import dev.usbharu.hideout.domain.model.ActivityPubStringResponse -import dev.usbharu.hideout.domain.model.ap.Follow -import dev.usbharu.hideout.domain.model.ap.Undo -import dev.usbharu.hideout.query.UserQueryService +import dev.usbharu.hideout.activitypub.domain.model.Follow +import dev.usbharu.hideout.activitypub.domain.model.Undo +import dev.usbharu.hideout.activitypub.interfaces.api.common.ActivityPubStringResponse +import dev.usbharu.hideout.activitypub.service.activity.undo.APUndoServiceImpl +import dev.usbharu.hideout.core.query.UserQueryService import io.ktor.http.* import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals diff --git a/src/test/kotlin/dev/usbharu/hideout/service/ap/resource/APResourceResolveServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/ap/resource/APResourceResolveServiceImplTest.kt index 87f5a553..8f77d9ff 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/ap/resource/APResourceResolveServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/ap/resource/APResourceResolveServiceImplTest.kt @@ -1,11 +1,14 @@ package dev.usbharu.hideout.service.ap.resource -import dev.usbharu.hideout.config.ApplicationConfig -import dev.usbharu.hideout.config.CharacterLimit -import dev.usbharu.hideout.domain.model.ap.Object -import dev.usbharu.hideout.domain.model.hideout.entity.Post -import dev.usbharu.hideout.domain.model.hideout.entity.User -import dev.usbharu.hideout.repository.UserRepository +import dev.usbharu.hideout.activitypub.domain.model.`object`.Object +import dev.usbharu.hideout.activitypub.service.common.APResourceResolveServiceImpl +import dev.usbharu.hideout.activitypub.service.common.InMemoryCacheManager +import dev.usbharu.hideout.activitypub.service.common.resolve +import dev.usbharu.hideout.application.config.ApplicationConfig +import dev.usbharu.hideout.application.config.CharacterLimit +import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.domain.model.user.User +import dev.usbharu.hideout.core.domain.model.user.UserRepository import io.ktor.client.* import io.ktor.client.engine.mock.* import kotlinx.coroutines.async diff --git a/src/test/kotlin/dev/usbharu/hideout/service/core/MetaServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/core/MetaServiceImplTest.kt index 546dab35..6432ead4 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/core/MetaServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/core/MetaServiceImplTest.kt @@ -2,10 +2,11 @@ package dev.usbharu.hideout.service.core -import dev.usbharu.hideout.domain.model.hideout.entity.Jwt -import dev.usbharu.hideout.domain.model.hideout.entity.Meta -import dev.usbharu.hideout.exception.NotInitException -import dev.usbharu.hideout.repository.MetaRepository +import dev.usbharu.hideout.application.service.init.MetaServiceImpl +import dev.usbharu.hideout.core.domain.exception.NotInitException +import dev.usbharu.hideout.core.domain.model.meta.Jwt +import dev.usbharu.hideout.core.domain.model.meta.Meta +import dev.usbharu.hideout.core.domain.model.meta.MetaRepository import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Test diff --git a/src/test/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseServiceImplTest.kt index e7f87517..18e7ced6 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseServiceImplTest.kt @@ -2,9 +2,10 @@ package dev.usbharu.hideout.service.core -import dev.usbharu.hideout.domain.model.hideout.entity.Jwt -import dev.usbharu.hideout.domain.model.hideout.entity.Meta -import dev.usbharu.hideout.repository.MetaRepository +import dev.usbharu.hideout.application.service.init.ServerInitialiseServiceImpl +import dev.usbharu.hideout.core.domain.model.meta.Jwt +import dev.usbharu.hideout.core.domain.model.meta.Meta +import dev.usbharu.hideout.core.domain.model.meta.MetaRepository import dev.usbharu.hideout.util.ServerUtil import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest diff --git a/src/test/kotlin/dev/usbharu/hideout/service/core/TwitterSnowflakeIdGenerateServiceTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/core/TwitterSnowflakeIdGenerateServiceTest.kt index 92bf53bb..cf15303e 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/core/TwitterSnowflakeIdGenerateServiceTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/core/TwitterSnowflakeIdGenerateServiceTest.kt @@ -1,6 +1,7 @@ package dev.usbharu.hideout.service.core // import kotlinx.coroutines.NonCancellable.message +import dev.usbharu.hideout.application.service.id.TwitterSnowflakeIdGenerateService import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch diff --git a/src/test/kotlin/dev/usbharu/hideout/service/user/UserServiceTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/user/UserServiceTest.kt index 663d7f40..e0664f2c 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/user/UserServiceTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/user/UserServiceTest.kt @@ -2,13 +2,12 @@ package dev.usbharu.hideout.service.user -import dev.usbharu.hideout.config.ApplicationConfig -import dev.usbharu.hideout.config.CharacterLimit -import dev.usbharu.hideout.domain.model.hideout.dto.RemoteUserCreateDto -import dev.usbharu.hideout.domain.model.hideout.dto.UserCreateDto -import dev.usbharu.hideout.domain.model.hideout.entity.Post -import dev.usbharu.hideout.domain.model.hideout.entity.User -import dev.usbharu.hideout.repository.UserRepository +import dev.usbharu.hideout.application.config.ApplicationConfig +import dev.usbharu.hideout.application.config.CharacterLimit +import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.domain.model.user.User +import dev.usbharu.hideout.core.domain.model.user.UserRepository +import dev.usbharu.hideout.core.service.user.* import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Test @@ -46,7 +45,7 @@ class UserServiceTest { ) userService.createLocalUser(UserCreateDto("test", "testUser", "XXXXXXXXXXXXX", "test")) verify(userRepository, times(1)).save(any()) - argumentCaptor { + argumentCaptor { verify(userRepository, times(1)).save(capture()) assertEquals("test", firstValue.name) assertEquals("testUser", firstValue.screenName) @@ -85,7 +84,7 @@ class UserServiceTest { ) userService.createRemoteUser(user) verify(userRepository, times(1)).save(any()) - argumentCaptor { + argumentCaptor { verify(userRepository, times(1)).save(capture()) assertEquals("test", firstValue.name) assertEquals("testUser", firstValue.screenName) diff --git a/src/test/kotlin/utils/PostBuilder.kt b/src/test/kotlin/utils/PostBuilder.kt index 630d006e..afe32938 100644 --- a/src/test/kotlin/utils/PostBuilder.kt +++ b/src/test/kotlin/utils/PostBuilder.kt @@ -1,9 +1,9 @@ package utils -import dev.usbharu.hideout.config.CharacterLimit -import dev.usbharu.hideout.domain.model.hideout.entity.Post -import dev.usbharu.hideout.domain.model.hideout.entity.Visibility -import dev.usbharu.hideout.service.core.TwitterSnowflakeIdGenerateService +import dev.usbharu.hideout.application.config.CharacterLimit +import dev.usbharu.hideout.application.service.id.TwitterSnowflakeIdGenerateService +import dev.usbharu.hideout.core.domain.model.post.Post +import dev.usbharu.hideout.core.domain.model.post.Visibility import kotlinx.coroutines.runBlocking import java.time.Instant diff --git a/src/test/kotlin/utils/TestApplicationConfig.kt b/src/test/kotlin/utils/TestApplicationConfig.kt index 9d064eab..036c7966 100644 --- a/src/test/kotlin/utils/TestApplicationConfig.kt +++ b/src/test/kotlin/utils/TestApplicationConfig.kt @@ -1,6 +1,6 @@ package utils -import dev.usbharu.hideout.config.ApplicationConfig +import dev.usbharu.hideout.application.config.ApplicationConfig import java.net.URL object TestApplicationConfig { diff --git a/src/test/kotlin/utils/TestTransaction.kt b/src/test/kotlin/utils/TestTransaction.kt index f8d1832c..d264f791 100644 --- a/src/test/kotlin/utils/TestTransaction.kt +++ b/src/test/kotlin/utils/TestTransaction.kt @@ -1,6 +1,6 @@ package utils -import dev.usbharu.hideout.service.core.Transaction +import dev.usbharu.hideout.application.external.Transaction object TestTransaction : Transaction { override suspend fun transaction(block: suspend () -> T): T = block() diff --git a/src/test/kotlin/utils/UserBuilder.kt b/src/test/kotlin/utils/UserBuilder.kt index d3294786..f5ea6688 100644 --- a/src/test/kotlin/utils/UserBuilder.kt +++ b/src/test/kotlin/utils/UserBuilder.kt @@ -1,9 +1,9 @@ package utils -import dev.usbharu.hideout.config.ApplicationConfig -import dev.usbharu.hideout.config.CharacterLimit -import dev.usbharu.hideout.domain.model.hideout.entity.User -import dev.usbharu.hideout.service.core.TwitterSnowflakeIdGenerateService +import dev.usbharu.hideout.application.config.ApplicationConfig +import dev.usbharu.hideout.application.config.CharacterLimit +import dev.usbharu.hideout.application.service.id.TwitterSnowflakeIdGenerateService +import dev.usbharu.hideout.core.domain.model.user.User import kotlinx.coroutines.runBlocking import java.net.URL import java.time.Instant diff --git a/templates/api.mustache b/templates/api.mustache index 9d0dc1da..46845778 100644 --- a/templates/api.mustache +++ b/templates/api.mustache @@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.* {{/useBeanValidation}} import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired -import dev.usbharu.hideout.config.JsonOrFormBind +import dev.usbharu.hideout.generate.JsonOrFormBind {{#useBeanValidation}} import {{javaxPackage}}.validation.Valid diff --git a/templates/apiController.mustache b/templates/apiController.mustache index 3c70a76f..8d65aee1 100644 --- a/templates/apiController.mustache +++ b/templates/apiController.mustache @@ -3,7 +3,7 @@ package {{package}} import org.springframework.stereotype.Controller import org.springframework.web.bind.annotation.RequestMapping import java.util.Optional -import dev.usbharu.hideout.config.JsonOrFormBind +import dev.usbharu.hideout.generate.JsonOrFormBind {{>generatedAnnotation}} @Controller{{#beanQualifiers}}("{{package}}.{{classname}}Controller"){{/beanQualifiers}} diff --git a/templates/apiInterface.mustache b/templates/apiInterface.mustache index ca99383c..99d240c5 100644 --- a/templates/apiInterface.mustache +++ b/templates/apiInterface.mustache @@ -51,7 +51,7 @@ import org.springframework.beans.factory.annotation.Autowired {{/reactive}} import kotlin.collections.List import kotlin.collections.Map -import dev.usbharu.hideout.config.JsonOrFormBind +import dev.usbharu.hideout.generate.JsonOrFormBind {{#useBeanValidation}} @Validated