From bde0b31d28d750fc462567aabcbeed95b0255167 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Sat, 14 Sep 2024 21:35:18 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20Application=20Service=E3=82=92?= =?UTF-8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF=E3=82=BF=E3=83=AA=E3=83=B3?= =?UTF-8?q?=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actor/GetActorDetailApplicationService.kt | 1 + .../actor/GetUserDetailApplicationService.kt | 1 + .../filter/UserGetFilterApplicationService.kt | 1 + .../UserRegisterFilterApplicationService.kt | 2 +- .../GetLocalInstanceApplicationService.kt | 1 + .../hideout/core/application/media/Media.kt | 50 --------------- .../core/application/media/UploadMedia.kt | 22 ------- .../media/UploadMediaApplicationService.kt | 16 ++++- .../{actor => model}/ActorDetail.kt | 9 +-- .../application/{filter => model}/Filter.kt | 4 +- .../{filter => model}/FilterKeyword.kt | 2 +- .../{instance => model}/Instance.kt | 4 +- .../application/{post => model}/PostDetail.kt | 6 +- .../get => model}/Relationship.kt | 4 +- .../{actor => model}/UserDetail.kt | 4 +- .../core/application/post/ActorDetail.kt | 31 --------- .../core/application/post/DeleteLocalPost.kt | 3 - .../post/DeleteLocalPostApplicationService.kt | 2 + .../hideout/core/application/post/GetPost.kt | 21 ------ .../post/GetPostApplicationService.kt | 48 -------------- .../post/GetPostDetailApplicationService.kt | 1 + .../get/GetRelationshipApplicationService.kt | 1 + .../core/application/timeline/AddPost.kt | 5 -- .../timeline/AddTimelineRelationship.kt | 11 ---- .../core/application/timeline/GetTimelines.kt | 3 - .../application/timeline/GetUserTimeline.kt | 5 -- .../GetUserTimelineApplicationService.kt | 5 +- .../core/application/timeline/ReadTimeline.kt | 11 ---- .../ReadTimelineApplicationService.kt | 11 +++- .../application/timeline/RegisterTimeline.kt | 8 --- .../timeline/RemoveTimelineRelationship.kt | 5 -- ...melineToTimelineStoreApplicationService.kt | 3 + .../application/timeline/SetTimleineStore.kt | 5 -- .../TimelineAddPostApplicationService.kt | 3 + ...dTimelineRelationshipApplicationService.kt | 9 +++ .../UserGetTimelinesApplicationService.kt | 2 + .../UserRegisterTimelineApplicationService.kt | 10 +-- ...eTimelineRelationshipApplicationService.kt | 3 + .../model/support/postdetail/PostDetail.kt | 22 ------- .../ExposedUserTimelineQueryService.kt | 4 +- .../usertimeline/UserTimelineQueryService.kt | 2 +- .../resources/templates/fragments-post.html | 4 +- .../templates/fragments-timeline.html | 2 +- .../post/GetPostApplicationServiceTest.kt | 64 ------------------- .../interfaces/api/SpringFilterApi.kt | 4 +- 45 files changed, 86 insertions(+), 349 deletions(-) delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/media/Media.kt delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/media/UploadMedia.kt rename hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/{actor => model}/ActorDetail.kt (78%) rename hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/{filter => model}/Filter.kt (95%) rename hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/{filter => model}/FilterKeyword.kt (93%) rename hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/{instance => model}/Instance.kt (85%) rename hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/{post => model}/PostDetail.kt (91%) rename hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/{relationship/get => model}/Relationship.kt (93%) rename hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/{actor => model}/UserDetail.kt (95%) delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/ActorDetail.kt delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/DeleteLocalPost.kt delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/GetPost.kt delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/GetPostApplicationService.kt delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/AddPost.kt delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/AddTimelineRelationship.kt delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/GetTimelines.kt delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/GetUserTimeline.kt delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/ReadTimeline.kt delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/RegisterTimeline.kt delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/RemoveTimelineRelationship.kt delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/SetTimleineStore.kt delete mode 100644 hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/postdetail/PostDetail.kt delete mode 100644 hideout-core/src/test/kotlin/dev/usbharu/hideout/core/application/post/GetPostApplicationServiceTest.kt diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/actor/GetActorDetailApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/actor/GetActorDetailApplicationService.kt index 722f16fe..c47c467e 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/actor/GetActorDetailApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/actor/GetActorDetailApplicationService.kt @@ -1,5 +1,6 @@ package dev.usbharu.hideout.core.application.actor +import dev.usbharu.hideout.core.application.model.ActorDetail import dev.usbharu.hideout.core.application.shared.AbstractApplicationService import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.config.ApplicationConfig diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/actor/GetUserDetailApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/actor/GetUserDetailApplicationService.kt index 6d990ee2..c6a3a4b1 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/actor/GetUserDetailApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/actor/GetUserDetailApplicationService.kt @@ -17,6 +17,7 @@ package dev.usbharu.hideout.core.application.actor import dev.usbharu.hideout.core.application.exception.InternalServerException +import dev.usbharu.hideout.core.application.model.UserDetail import dev.usbharu.hideout.core.application.shared.AbstractApplicationService import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.domain.model.actor.ActorRepository diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/filter/UserGetFilterApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/filter/UserGetFilterApplicationService.kt index 1038fe2a..afad3897 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/filter/UserGetFilterApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/filter/UserGetFilterApplicationService.kt @@ -17,6 +17,7 @@ package dev.usbharu.hideout.core.application.filter import dev.usbharu.hideout.core.application.exception.PermissionDeniedException +import dev.usbharu.hideout.core.application.model.Filter import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.domain.model.filter.FilterId diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/filter/UserRegisterFilterApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/filter/UserRegisterFilterApplicationService.kt index 4baa0ac3..68b7dc0f 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/filter/UserRegisterFilterApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/filter/UserRegisterFilterApplicationService.kt @@ -16,10 +16,10 @@ package dev.usbharu.hideout.core.application.filter +import dev.usbharu.hideout.core.application.model.Filter import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.domain.model.filter.* -import dev.usbharu.hideout.core.domain.model.filter.FilterKeyword import dev.usbharu.hideout.core.domain.model.support.principal.LocalUser import dev.usbharu.hideout.core.domain.shared.id.IdGenerateService import org.slf4j.LoggerFactory diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/instance/GetLocalInstanceApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/instance/GetLocalInstanceApplicationService.kt index cdca8b84..dcd32818 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/instance/GetLocalInstanceApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/instance/GetLocalInstanceApplicationService.kt @@ -1,6 +1,7 @@ package dev.usbharu.hideout.core.application.instance import dev.usbharu.hideout.core.application.exception.InternalServerException +import dev.usbharu.hideout.core.application.model.Instance import dev.usbharu.hideout.core.application.shared.AbstractApplicationService import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.config.ApplicationConfig diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/media/Media.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/media/Media.kt deleted file mode 100644 index 5ff3e4a8..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/media/Media.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2024 usbharu - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dev.usbharu.hideout.core.application.media - -import dev.usbharu.hideout.core.domain.model.media.FileType -import dev.usbharu.hideout.core.domain.model.media.Media -import dev.usbharu.hideout.core.domain.model.media.MimeType -import java.net.URI - -data class Media( - val id: Long, - val name: String, - val url: URI, - val thumbprintURI: URI?, - val remoteURL: URI?, - val type: FileType, - val mimeType: MimeType, - val blurHash: String?, - val description: String? -) { - companion object { - fun of(media: Media): dev.usbharu.hideout.core.application.media.Media { - return Media( - id = media.id.id, - name = media.name.name, - url = media.url, - thumbprintURI = media.thumbnailUrl, - remoteURL = media.remoteUrl, - type = media.type, - mimeType = media.mimeType, - blurHash = media.blurHash?.hash, - description = media.description?.description - ) - } - } -} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/media/UploadMedia.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/media/UploadMedia.kt deleted file mode 100644 index 4a8af8d3..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/media/UploadMedia.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2024 usbharu - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dev.usbharu.hideout.core.application.media - -import java.net.URI -import java.nio.file.Path - -data class UploadMedia(val path: Path, val name: String, val remoteUri: URI?, val description: String?) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/media/UploadMediaApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/media/UploadMediaApplicationService.kt index 8f796c7f..a68e64d7 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/media/UploadMediaApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/media/UploadMediaApplicationService.kt @@ -16,6 +16,7 @@ package dev.usbharu.hideout.core.application.media +import dev.usbharu.hideout.core.application.post.MediaDetail import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.domain.model.media.* @@ -26,6 +27,8 @@ import dev.usbharu.hideout.core.external.mediastore.MediaStore import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Qualifier import org.springframework.stereotype.Service +import java.net.URI +import java.nio.file.Path import dev.usbharu.hideout.core.domain.model.media.Media as MediaModel @Service @@ -35,11 +38,11 @@ class UploadMediaApplicationService( private val mediaRepository: MediaRepository, private val idGenerateService: IdGenerateService, transaction: Transaction -) : LocalUserAbstractApplicationService( +) : LocalUserAbstractApplicationService( transaction, logger ) { - override suspend fun internalExecute(command: UploadMedia, principal: LocalUser): Media { + override suspend fun internalExecute(command: UploadMedia, principal: LocalUser): MediaDetail { val process = mediaProcessor.process(command.path, command.name, null) val id = idGenerateService.generateId() val thumbnailUri = if (process.thumbnailPath != null) { @@ -64,10 +67,17 @@ class UploadMediaApplicationService( mediaRepository.save(media) - return Media.of(media) + return MediaDetail.of(media) } companion object { private val logger = LoggerFactory.getLogger(UploadMediaApplicationService::class.java) } } + +data class UploadMedia( + val path: Path, + val name: String, + val remoteUri: URI?, + val description: String? +) \ No newline at end of file diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/actor/ActorDetail.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/ActorDetail.kt similarity index 78% rename from hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/actor/ActorDetail.kt rename to hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/ActorDetail.kt index d0c552c0..851dcd44 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/actor/ActorDetail.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/ActorDetail.kt @@ -1,6 +1,7 @@ -package dev.usbharu.hideout.core.application.actor +package dev.usbharu.hideout.core.application.model import dev.usbharu.hideout.core.domain.model.actor.Actor +import dev.usbharu.hideout.core.domain.model.media.Media import java.net.URI data class ActorDetail( @@ -18,7 +19,7 @@ data class ActorDetail( val followersCount: Int?, ) { companion object { - fun of(actor: Actor, iconUrl: URI?, bannerURL: URI?): ActorDetail { + fun of(actor: Actor, iconMedia: Media?, bannerMedia: Media?): ActorDetail { return ActorDetail( id = actor.id.id, name = actor.name.name, @@ -28,8 +29,8 @@ data class ActorDetail( locked = actor.locked, description = actor.description.description, postsCount = actor.postsCount.postsCount, - iconUrl = iconUrl, - bannerURL = bannerURL, + iconUrl = iconMedia?.url, + bannerURL = bannerMedia?.url, followingCount = actor.followingCount?.relationshipCount, followersCount = actor.followersCount?.relationshipCount, ) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/filter/Filter.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/Filter.kt similarity index 95% rename from hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/filter/Filter.kt rename to hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/Filter.kt index e482991a..f2c625aa 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/filter/Filter.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/Filter.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package dev.usbharu.hideout.core.application.filter +package dev.usbharu.hideout.core.application.model import dev.usbharu.hideout.core.domain.model.filter.Filter import dev.usbharu.hideout.core.domain.model.filter.FilterAction @@ -29,7 +29,7 @@ data class Filter( val filterKeywords: Set, ) { companion object { - fun of(filter: Filter): dev.usbharu.hideout.core.application.filter.Filter { + fun of(filter: Filter): dev.usbharu.hideout.core.application.model.Filter { return Filter( filterId = filter.id.id, userDetailId = filter.userDetailId.id, diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/filter/FilterKeyword.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/FilterKeyword.kt similarity index 93% rename from hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/filter/FilterKeyword.kt rename to hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/FilterKeyword.kt index bb58f6e6..14eeca8b 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/filter/FilterKeyword.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/FilterKeyword.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package dev.usbharu.hideout.core.application.filter +package dev.usbharu.hideout.core.application.model import dev.usbharu.hideout.core.domain.model.filter.FilterMode diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/instance/Instance.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/Instance.kt similarity index 85% rename from hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/instance/Instance.kt rename to hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/Instance.kt index c4853256..1bea3157 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/instance/Instance.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/Instance.kt @@ -1,11 +1,11 @@ -package dev.usbharu.hideout.core.application.instance +package dev.usbharu.hideout.core.application.model import dev.usbharu.hideout.core.domain.model.instance.Instance import java.net.URI data class Instance(val id: Long, val name: String, val url: URI, val description: String) { companion object { - fun of(instance: Instance): dev.usbharu.hideout.core.application.instance.Instance { + fun of(instance: Instance): dev.usbharu.hideout.core.application.model.Instance { return Instance( instance.id.instanceId, instance.name.name, diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/PostDetail.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/PostDetail.kt similarity index 91% rename from hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/PostDetail.kt rename to hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/PostDetail.kt index 67dd9d96..1ccdc1a8 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/PostDetail.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/PostDetail.kt @@ -1,6 +1,6 @@ -package dev.usbharu.hideout.core.application.post +package dev.usbharu.hideout.core.application.model -import dev.usbharu.hideout.core.application.model.Reactions +import dev.usbharu.hideout.core.application.post.MediaDetail import dev.usbharu.hideout.core.domain.model.actor.Actor import dev.usbharu.hideout.core.domain.model.media.Media import dev.usbharu.hideout.core.domain.model.post.Post @@ -43,7 +43,7 @@ data class PostDetail( ): PostDetail { return PostDetail( id = post.id.id, - actor = ActorDetail.of(actor, iconMedia), + actor = ActorDetail.of(actor, iconMedia, null), overview = post.overview?.overview, text = post.text, content = post.content.content, diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/relationship/get/Relationship.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/Relationship.kt similarity index 93% rename from hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/relationship/get/Relationship.kt rename to hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/Relationship.kt index 03237ef4..9bd6e474 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/relationship/get/Relationship.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/Relationship.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package dev.usbharu.hideout.core.application.relationship.get +package dev.usbharu.hideout.core.application.model import dev.usbharu.hideout.core.domain.model.actorinstancerelationship.ActorInstanceRelationship import dev.usbharu.hideout.core.domain.model.relationship.Relationship @@ -38,7 +38,7 @@ data class Relationship( relationship: Relationship, relationship2: Relationship, actorInstanceRelationship: ActorInstanceRelationship, - ): dev.usbharu.hideout.core.application.relationship.get.Relationship { + ): dev.usbharu.hideout.core.application.model.Relationship { return Relationship( actorId = relationship.actorId.id, targetId = relationship.targetActorId.id, diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/actor/UserDetail.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/UserDetail.kt similarity index 95% rename from hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/actor/UserDetail.kt rename to hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/UserDetail.kt index 5b363296..bdf49fb6 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/actor/UserDetail.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/model/UserDetail.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package dev.usbharu.hideout.core.application.actor +package dev.usbharu.hideout.core.application.model import dev.usbharu.hideout.core.domain.model.actor.Actor import dev.usbharu.hideout.core.domain.model.emoji.CustomEmoji @@ -45,7 +45,7 @@ data class UserDetail( actor: Actor, userDetail: UserDetail, customEmojis: List, - ): dev.usbharu.hideout.core.application.actor.UserDetail { + ): dev.usbharu.hideout.core.application.model.UserDetail { return UserDetail( id = actor.id.id, userDetailId = userDetail.id.id, diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/ActorDetail.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/ActorDetail.kt deleted file mode 100644 index 7ef57687..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/ActorDetail.kt +++ /dev/null @@ -1,31 +0,0 @@ -package dev.usbharu.hideout.core.application.post - -import dev.usbharu.hideout.core.domain.model.actor.Actor -import dev.usbharu.hideout.core.domain.model.media.Media -import java.net.URI - -data class ActorDetail( - val actorId: Long, - val instanceId: Long, - val name: String, - val domain: String, - val screenName: String, - val url: URI, - val locked: Boolean, - val icon: URI?, -) { - companion object { - fun of(actor: Actor, iconMedia: Media?): ActorDetail { - return ActorDetail( - actorId = actor.id.id, - instanceId = actor.instance.instanceId, - name = actor.name.name, - domain = actor.domain.domain, - screenName = actor.screenName.screenName, - url = actor.url, - locked = actor.locked, - icon = iconMedia?.url - ) - } - } -} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/DeleteLocalPost.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/DeleteLocalPost.kt deleted file mode 100644 index 83da8dd1..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/DeleteLocalPost.kt +++ /dev/null @@ -1,3 +0,0 @@ -package dev.usbharu.hideout.core.application.post - -data class DeleteLocalPost(val postId: Long) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/DeleteLocalPostApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/DeleteLocalPostApplicationService.kt index 48441863..4531ba50 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/DeleteLocalPostApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/DeleteLocalPostApplicationService.kt @@ -50,3 +50,5 @@ class DeleteLocalPostApplicationService( private val logger = LoggerFactory.getLogger(DeleteLocalPostApplicationService::class.java) } } + +data class DeleteLocalPost(val postId: Long) \ No newline at end of file diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/GetPost.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/GetPost.kt deleted file mode 100644 index 90ef8560..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/GetPost.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2024 usbharu - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dev.usbharu.hideout.core.application.post - -data class GetPost( - val postId: Long, -) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/GetPostApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/GetPostApplicationService.kt deleted file mode 100644 index 6e1f0006..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/GetPostApplicationService.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2024 usbharu - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dev.usbharu.hideout.core.application.post - -import dev.usbharu.hideout.core.application.exception.PermissionDeniedException -import dev.usbharu.hideout.core.application.shared.AbstractApplicationService -import dev.usbharu.hideout.core.application.shared.Transaction -import dev.usbharu.hideout.core.domain.model.post.PostId -import dev.usbharu.hideout.core.domain.model.post.PostRepository -import dev.usbharu.hideout.core.domain.model.support.principal.Principal -import dev.usbharu.hideout.core.domain.service.post.IPostReadAccessControl -import org.slf4j.LoggerFactory -import org.springframework.stereotype.Service - -@Service -class GetPostApplicationService( - private val postRepository: PostRepository, - private val iPostReadAccessControl: IPostReadAccessControl, - transaction: Transaction -) : - AbstractApplicationService(transaction, logger) { - - override suspend fun internalExecute(command: GetPost, principal: Principal): Post { - val post = postRepository.findById(PostId(command.postId)) ?: throw IllegalArgumentException("Post not found") - if (iPostReadAccessControl.isAllow(post, principal).not()) { - throw PermissionDeniedException() - } - return Post.of(post) - } - - companion object { - private val logger = LoggerFactory.getLogger(GetPostApplicationService::class.java) - } -} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/GetPostDetailApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/GetPostDetailApplicationService.kt index 89dd080e..5ad4a75f 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/GetPostDetailApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/post/GetPostDetailApplicationService.kt @@ -1,6 +1,7 @@ package dev.usbharu.hideout.core.application.post import dev.usbharu.hideout.core.application.exception.InternalServerException +import dev.usbharu.hideout.core.application.model.PostDetail import dev.usbharu.hideout.core.application.shared.AbstractApplicationService import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.domain.model.actor.Actor diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/relationship/get/GetRelationshipApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/relationship/get/GetRelationshipApplicationService.kt index bbecd56d..3ce773c5 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/relationship/get/GetRelationshipApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/relationship/get/GetRelationshipApplicationService.kt @@ -17,6 +17,7 @@ package dev.usbharu.hideout.core.application.relationship.get import dev.usbharu.hideout.core.application.exception.InternalServerException +import dev.usbharu.hideout.core.application.model.Relationship import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.domain.model.actor.ActorId diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/AddPost.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/AddPost.kt deleted file mode 100644 index bae9fc85..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/AddPost.kt +++ /dev/null @@ -1,5 +0,0 @@ -package dev.usbharu.hideout.core.application.timeline - -import dev.usbharu.hideout.core.domain.model.post.PostId - -data class AddPost(val postId: PostId) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/AddTimelineRelationship.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/AddTimelineRelationship.kt deleted file mode 100644 index 21684dda..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/AddTimelineRelationship.kt +++ /dev/null @@ -1,11 +0,0 @@ -package dev.usbharu.hideout.core.application.timeline - -import dev.usbharu.hideout.core.domain.model.actor.ActorId -import dev.usbharu.hideout.core.domain.model.timeline.TimelineId -import dev.usbharu.hideout.core.domain.model.timelinerelationship.Visible - -data class AddTimelineRelationship( - val timelineId: TimelineId, - val actorId: ActorId, - val visible: Visible -) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/GetTimelines.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/GetTimelines.kt deleted file mode 100644 index a4233829..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/GetTimelines.kt +++ /dev/null @@ -1,3 +0,0 @@ -package dev.usbharu.hideout.core.application.timeline - -data class GetTimelines(val userDetailId: Long) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/GetUserTimeline.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/GetUserTimeline.kt deleted file mode 100644 index 8ebc7d15..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/GetUserTimeline.kt +++ /dev/null @@ -1,5 +0,0 @@ -package dev.usbharu.hideout.core.application.timeline - -import dev.usbharu.hideout.core.domain.model.support.page.Page - -data class GetUserTimeline(val id: Long, val page: Page) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/GetUserTimelineApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/GetUserTimelineApplicationService.kt index 0d85511c..68684900 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/GetUserTimelineApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/GetUserTimelineApplicationService.kt @@ -1,12 +1,13 @@ package dev.usbharu.hideout.core.application.timeline -import dev.usbharu.hideout.core.application.post.PostDetail +import dev.usbharu.hideout.core.application.model.PostDetail import dev.usbharu.hideout.core.application.shared.AbstractApplicationService import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.domain.model.actor.ActorId import dev.usbharu.hideout.core.domain.model.post.PostId 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.support.page.Page import dev.usbharu.hideout.core.domain.model.support.page.PaginationList import dev.usbharu.hideout.core.domain.model.support.principal.Principal import dev.usbharu.hideout.core.query.usertimeline.UserTimelineQueryService @@ -51,3 +52,5 @@ class GetUserTimelineApplicationService( private val logger = LoggerFactory.getLogger(GetUserTimelineApplicationService::class.java) } } + +data class GetUserTimeline(val id: Long, val page: Page) \ No newline at end of file diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/ReadTimeline.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/ReadTimeline.kt deleted file mode 100644 index 40e11367..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/ReadTimeline.kt +++ /dev/null @@ -1,11 +0,0 @@ -package dev.usbharu.hideout.core.application.timeline - -import dev.usbharu.hideout.core.domain.model.support.page.Page - -data class ReadTimeline( - val timelineId: Long, - val mediaOnly: Boolean, - val localOnly: Boolean, - val remoteOnly: Boolean, - val page: Page -) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/ReadTimelineApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/ReadTimelineApplicationService.kt index 53c18e48..4c30354a 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/ReadTimelineApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/ReadTimelineApplicationService.kt @@ -1,9 +1,10 @@ package dev.usbharu.hideout.core.application.timeline -import dev.usbharu.hideout.core.application.post.PostDetail +import dev.usbharu.hideout.core.application.model.PostDetail import dev.usbharu.hideout.core.application.shared.AbstractApplicationService import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.domain.model.post.PostId +import dev.usbharu.hideout.core.domain.model.support.page.Page import dev.usbharu.hideout.core.domain.model.support.page.PaginationList import dev.usbharu.hideout.core.domain.model.support.principal.Principal import dev.usbharu.hideout.core.domain.model.timeline.TimelineId @@ -88,3 +89,11 @@ class ReadTimelineApplicationService( private val logger = LoggerFactory.getLogger(ReadTimelineApplicationService::class.java) } } + +data class ReadTimeline( + val timelineId: Long, + val mediaOnly: Boolean, + val localOnly: Boolean, + val remoteOnly: Boolean, + val page: Page +) \ No newline at end of file diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/RegisterTimeline.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/RegisterTimeline.kt deleted file mode 100644 index 4283e651..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/RegisterTimeline.kt +++ /dev/null @@ -1,8 +0,0 @@ -package dev.usbharu.hideout.core.application.timeline - -import dev.usbharu.hideout.core.domain.model.timeline.TimelineVisibility - -data class RegisterTimeline( - val timelineName: String, - val visibility: TimelineVisibility -) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/RemoveTimelineRelationship.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/RemoveTimelineRelationship.kt deleted file mode 100644 index 5565ca22..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/RemoveTimelineRelationship.kt +++ /dev/null @@ -1,5 +0,0 @@ -package dev.usbharu.hideout.core.application.timeline - -import dev.usbharu.hideout.core.domain.model.timelinerelationship.TimelineRelationshipId - -data class RemoveTimelineRelationship(val timelineRelationshipId: TimelineRelationshipId) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/SetTimelineToTimelineStoreApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/SetTimelineToTimelineStoreApplicationService.kt index 139b6b55..a0a9e79b 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/SetTimelineToTimelineStoreApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/SetTimelineToTimelineStoreApplicationService.kt @@ -3,6 +3,7 @@ package dev.usbharu.hideout.core.application.timeline import dev.usbharu.hideout.core.application.shared.AbstractApplicationService import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.domain.model.support.principal.Principal +import dev.usbharu.hideout.core.domain.model.timeline.TimelineId import dev.usbharu.hideout.core.domain.model.timeline.TimelineRepository import dev.usbharu.hideout.core.external.timeline.TimelineStore import org.slf4j.LoggerFactory @@ -28,3 +29,5 @@ class SetTimelineToTimelineStoreApplicationService( private val logger = LoggerFactory.getLogger(SetTimelineToTimelineStoreApplicationService::class.java) } } + +data class SetTimleineStore(val timelineId: TimelineId) \ No newline at end of file diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/SetTimleineStore.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/SetTimleineStore.kt deleted file mode 100644 index a2257489..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/SetTimleineStore.kt +++ /dev/null @@ -1,5 +0,0 @@ -package dev.usbharu.hideout.core.application.timeline - -import dev.usbharu.hideout.core.domain.model.timeline.TimelineId - -data class SetTimleineStore(val timelineId: TimelineId) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/TimelineAddPostApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/TimelineAddPostApplicationService.kt index c00b54ef..022133eb 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/TimelineAddPostApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/TimelineAddPostApplicationService.kt @@ -2,6 +2,7 @@ package dev.usbharu.hideout.core.application.timeline import dev.usbharu.hideout.core.application.shared.AbstractApplicationService import dev.usbharu.hideout.core.application.shared.Transaction +import dev.usbharu.hideout.core.domain.model.post.PostId import dev.usbharu.hideout.core.domain.model.post.PostRepository import dev.usbharu.hideout.core.domain.model.support.principal.Principal import dev.usbharu.hideout.core.external.timeline.TimelineStore @@ -27,3 +28,5 @@ class TimelineAddPostApplicationService( private val logger = LoggerFactory.getLogger(TimelineAddPostApplicationService::class.java) } } + +data class AddPost(val postId: PostId) \ No newline at end of file diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserAddTimelineRelationshipApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserAddTimelineRelationshipApplicationService.kt index d78f03b2..4525511c 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserAddTimelineRelationshipApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserAddTimelineRelationshipApplicationService.kt @@ -3,11 +3,14 @@ package dev.usbharu.hideout.core.application.timeline import dev.usbharu.hideout.core.application.exception.PermissionDeniedException import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.Transaction +import dev.usbharu.hideout.core.domain.model.actor.ActorId import dev.usbharu.hideout.core.domain.model.support.principal.LocalUser +import dev.usbharu.hideout.core.domain.model.timeline.TimelineId import dev.usbharu.hideout.core.domain.model.timeline.TimelineRepository import dev.usbharu.hideout.core.domain.model.timelinerelationship.TimelineRelationship import dev.usbharu.hideout.core.domain.model.timelinerelationship.TimelineRelationshipId import dev.usbharu.hideout.core.domain.model.timelinerelationship.TimelineRelationshipRepository +import dev.usbharu.hideout.core.domain.model.timelinerelationship.Visible import dev.usbharu.hideout.core.domain.shared.id.IdGenerateService import org.slf4j.LoggerFactory import org.springframework.stereotype.Service @@ -45,3 +48,9 @@ class UserAddTimelineRelationshipApplicationService( private val logger = LoggerFactory.getLogger(UserAddTimelineRelationshipApplicationService::class.java) } } + +data class AddTimelineRelationship( + val timelineId: TimelineId, + val actorId: ActorId, + val visible: Visible +) \ No newline at end of file diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserGetTimelinesApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserGetTimelinesApplicationService.kt index 2ebced42..b780e7e3 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserGetTimelinesApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserGetTimelinesApplicationService.kt @@ -35,3 +35,5 @@ class UserGetTimelinesApplicationService(transaction: Transaction, private val t private val logger = LoggerFactory.getLogger(UserGetTimelinesApplicationService::class.java) } } + +data class GetTimelines(val userDetailId: Long) \ No newline at end of file diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserRegisterTimelineApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserRegisterTimelineApplicationService.kt index 5b0af07c..d35ea2a6 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserRegisterTimelineApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserRegisterTimelineApplicationService.kt @@ -3,10 +3,7 @@ package dev.usbharu.hideout.core.application.timeline import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.domain.model.support.principal.LocalUser -import dev.usbharu.hideout.core.domain.model.timeline.Timeline -import dev.usbharu.hideout.core.domain.model.timeline.TimelineId -import dev.usbharu.hideout.core.domain.model.timeline.TimelineName -import dev.usbharu.hideout.core.domain.model.timeline.TimelineRepository +import dev.usbharu.hideout.core.domain.model.timeline.* import dev.usbharu.hideout.core.domain.shared.id.IdGenerateService import org.slf4j.LoggerFactory import org.springframework.stereotype.Component @@ -35,3 +32,8 @@ class UserRegisterTimelineApplicationService( private val logger = LoggerFactory.getLogger(UserRegisterTimelineApplicationService::class.java) } } + +data class RegisterTimeline( + val timelineName: String, + val visibility: TimelineVisibility +) \ No newline at end of file diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserRemoveTimelineRelationshipApplicationService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserRemoveTimelineRelationshipApplicationService.kt index ee2819bd..d3ef0d54 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserRemoveTimelineRelationshipApplicationService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/timeline/UserRemoveTimelineRelationshipApplicationService.kt @@ -5,6 +5,7 @@ import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationS import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.domain.model.support.principal.LocalUser import dev.usbharu.hideout.core.domain.model.timeline.TimelineRepository +import dev.usbharu.hideout.core.domain.model.timelinerelationship.TimelineRelationshipId import dev.usbharu.hideout.core.domain.model.timelinerelationship.TimelineRelationshipRepository import org.slf4j.LoggerFactory import org.springframework.stereotype.Service @@ -42,3 +43,5 @@ class UserRemoveTimelineRelationshipApplicationService( private val logger = LoggerFactory.getLogger(UserRemoveTimelineRelationshipApplicationService::class.java) } } + +data class RemoveTimelineRelationship(val timelineRelationshipId: TimelineRelationshipId) \ No newline at end of file diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/postdetail/PostDetail.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/postdetail/PostDetail.kt deleted file mode 100644 index 5126aa35..00000000 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/postdetail/PostDetail.kt +++ /dev/null @@ -1,22 +0,0 @@ -package dev.usbharu.hideout.core.domain.model.support.postdetail - -import dev.usbharu.hideout.core.domain.model.actor.Actor -import dev.usbharu.hideout.core.domain.model.post.Post - -data class PostDetail( - val post: Post, - val reply: Post? = null, - val repost: Post? = null, - val postActor: Actor, - val replyActor: Actor? = null, - val repostActor: Actor? = null -) { - init { - require(post.replyId == reply?.id) - require(post.repostId == repost?.id) - - require(post.actorId == postActor.id) - require(reply?.actorId == replyActor?.id) - require(repost?.actorId == repostActor?.id) - } -} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/ExposedUserTimelineQueryService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/ExposedUserTimelineQueryService.kt index f63a2e53..f04cf6be 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/ExposedUserTimelineQueryService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedquery/ExposedUserTimelineQueryService.kt @@ -1,8 +1,8 @@ package dev.usbharu.hideout.core.infrastructure.exposedquery -import dev.usbharu.hideout.core.application.post.ActorDetail +import dev.usbharu.hideout.core.application.model.ActorDetail +import dev.usbharu.hideout.core.application.model.PostDetail import dev.usbharu.hideout.core.application.post.MediaDetail -import dev.usbharu.hideout.core.application.post.PostDetail import dev.usbharu.hideout.core.domain.model.post.PostId import dev.usbharu.hideout.core.domain.model.post.Visibility import dev.usbharu.hideout.core.domain.model.support.principal.Principal diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/query/usertimeline/UserTimelineQueryService.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/query/usertimeline/UserTimelineQueryService.kt index 2981cfa7..ca5eb505 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/query/usertimeline/UserTimelineQueryService.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/query/usertimeline/UserTimelineQueryService.kt @@ -1,6 +1,6 @@ package dev.usbharu.hideout.core.query.usertimeline -import dev.usbharu.hideout.core.application.post.PostDetail +import dev.usbharu.hideout.core.application.model.PostDetail import dev.usbharu.hideout.core.domain.model.post.PostId import dev.usbharu.hideout.core.domain.model.support.principal.Principal diff --git a/hideout-core/src/main/resources/templates/fragments-post.html b/hideout-core/src/main/resources/templates/fragments-post.html index d16f4861..a58fb594 100644 --- a/hideout-core/src/main/resources/templates/fragments-post.html +++ b/hideout-core/src/main/resources/templates/fragments-post.html @@ -8,7 +8,7 @@
- +
- +
Reply diff --git a/hideout-core/src/main/resources/templates/fragments-timeline.html b/hideout-core/src/main/resources/templates/fragments-timeline.html index ef29250c..9d89d30b 100644 --- a/hideout-core/src/main/resources/templates/fragments-timeline.html +++ b/hideout-core/src/main/resources/templates/fragments-timeline.html @@ -6,7 +6,7 @@ - + diff --git a/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/application/post/GetPostApplicationServiceTest.kt b/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/application/post/GetPostApplicationServiceTest.kt deleted file mode 100644 index c8cf9561..00000000 --- a/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/application/post/GetPostApplicationServiceTest.kt +++ /dev/null @@ -1,64 +0,0 @@ -package dev.usbharu.hideout.core.application.post - -import dev.usbharu.hideout.core.application.exception.PermissionDeniedException -import dev.usbharu.hideout.core.domain.model.post.PostId -import dev.usbharu.hideout.core.domain.model.post.PostRepository -import dev.usbharu.hideout.core.domain.model.post.TestPostFactory -import dev.usbharu.hideout.core.domain.model.support.principal.Anonymous -import dev.usbharu.hideout.core.domain.service.post.IPostReadAccessControl -import kotlinx.coroutines.test.runTest -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertThrows -import org.junit.jupiter.api.extension.ExtendWith -import org.mockito.InjectMocks -import org.mockito.Mock -import org.mockito.Spy -import org.mockito.junit.jupiter.MockitoExtension -import org.mockito.kotlin.any -import org.mockito.kotlin.doReturn -import org.mockito.kotlin.whenever -import utils.TestTransaction - -@ExtendWith(MockitoExtension::class) -class GetPostApplicationServiceTest { - @InjectMocks - lateinit var service: GetPostApplicationService - - @Mock - lateinit var postRepository: PostRepository - - @Mock - lateinit var iPostReadAccessControl: IPostReadAccessControl - - @Spy - val transaction = TestTransaction - - @Test - fun postReadAccessControlがtrueを返したらPostが返ってくる() = runTest { - val post = TestPostFactory.create(id = 1) - whenever(postRepository.findById(PostId(1))).doReturn(post) - whenever(iPostReadAccessControl.isAllow(any(), any())).doReturn(true) - - val actual = service.execute(GetPost(1), Anonymous) - assertEquals(Post.of(post), actual) - } - - @Test - fun postが見つからない場合失敗() = runTest { - assertThrows { - service.execute(GetPost(2), Anonymous) - } - } - - @Test - fun postReadAccessControlがfalseを返したら失敗() = runTest { - val post = TestPostFactory.create(id = 1) - whenever(postRepository.findById(PostId(1))).doReturn(post) - whenever(iPostReadAccessControl.isAllow(any(), any())).doReturn(false) - assertThrows { - service.execute(GetPost(1), Anonymous) - } - - } -} \ No newline at end of file diff --git a/hideout-mastodon/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/SpringFilterApi.kt b/hideout-mastodon/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/SpringFilterApi.kt index 788a4c29..1734be87 100644 --- a/hideout-mastodon/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/SpringFilterApi.kt +++ b/hideout-mastodon/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/SpringFilterApi.kt @@ -27,8 +27,6 @@ import dev.usbharu.hideout.mastodon.application.filter.GetFilterV1 import dev.usbharu.hideout.mastodon.application.filter.GetFilterV1ApplicationService import dev.usbharu.hideout.mastodon.interfaces.api.generated.FilterApi import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.* -import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.Filter -import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.FilterKeyword import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.FilterPostRequest.Context import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.V1FilterPostRequest.Context.* import org.springframework.http.ResponseEntity @@ -131,7 +129,7 @@ class SpringFilterApi( ) } - private fun filter(filter: dev.usbharu.hideout.core.application.filter.Filter) = Filter( + private fun filter(filter: dev.usbharu.hideout.core.application.model.Filter) = Filter( id = filter.filterId.toString(), title = filter.name, context = filter.filterContext.map {