From 8e84c8e59cb085c0e759a8d6c2cef48e24dfe81e Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Sat, 20 Jul 2024 16:23:59 +0900 Subject: [PATCH] style: fix lint --- .../domainevent/subscribers/Subscriber.kt | 3 +- .../subscribers/SubscriberRunner.kt | 5 +-- .../TimelinePostCreateSubscriber.kt | 8 ++-- .../hideout/core/config/FlywayConfig.kt | 2 +- .../ActorInstanceRelationshipEvent.kt | 4 +- .../domain/event/timeline/TimelineEvent.kt | 2 +- .../model/followtimeline/FollowTimeline.kt | 2 +- .../FollowTimelineRepository.kt | 2 +- .../hideout/core/domain/model/post/Post.kt | 2 - .../relationship/RelationshipRepository.kt | 3 +- .../core/domain/model/support/page/Page.kt | 2 +- .../model/support/page/PaginationList.kt | 2 +- .../model/support/postdetail/PostDetail.kt | 2 +- .../TimelineObjectDetail.kt | 2 +- .../core/domain/model/timeline/Timeline.kt | 2 +- .../model/timeline/TimelineRepository.kt | 2 +- .../model/timeline/TimelineVisibility.kt | 2 +- .../model/timelineobject/TimelineObject.kt | 3 +- .../TimelineObjectWarnFilter.kt | 4 +- .../TimelineRelationship.kt | 2 +- .../TimelineRelationshipRepository.kt | 2 +- .../core/external/timeline/TimelineStore.kt | 2 +- .../ExposedPostRepository.kt | 41 +++++++++++-------- .../ExposedRelationshipRepository.kt | 3 +- .../ExposedTimelineRelationshipRepository.kt | 2 +- .../ExposedTimelineRepository.kt | 9 ++-- .../MongoInternalTimelineObjectRepository.kt | 8 ++-- .../SpringFrameworkDomainEventSubscriber.kt | 3 +- .../timeline/AbstractTimelineStore.kt | 20 +++++++-- .../timeline/DefaultTimelineStore.kt | 2 +- .../InternalTimelineObjectRepository.kt | 2 +- 31 files changed, 80 insertions(+), 70 deletions(-) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/domainevent/subscribers/Subscriber.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/domainevent/subscribers/Subscriber.kt index 4a430bea..a538b87a 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/domainevent/subscribers/Subscriber.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/domainevent/subscribers/Subscriber.kt @@ -1,4 +1,3 @@ package dev.usbharu.hideout.core.application.domainevent.subscribers -interface Subscriber { -} \ No newline at end of file +interface Subscriber diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/domainevent/subscribers/SubscriberRunner.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/domainevent/subscribers/SubscriberRunner.kt index 14b51199..b932b8dc 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/domainevent/subscribers/SubscriberRunner.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/domainevent/subscribers/SubscriberRunner.kt @@ -5,8 +5,7 @@ import org.springframework.boot.ApplicationRunner import org.springframework.stereotype.Component @Component -class SubscriberRunner(subscribers:List) : ApplicationRunner { +class SubscriberRunner(subscribers: List) : ApplicationRunner { override fun run(args: ApplicationArguments?) { - } -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/domainevent/subscribers/TimelinePostCreateSubscriber.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/domainevent/subscribers/TimelinePostCreateSubscriber.kt index 08555477..28b0004a 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/domainevent/subscribers/TimelinePostCreateSubscriber.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/application/domainevent/subscribers/TimelinePostCreateSubscriber.kt @@ -3,22 +3,20 @@ package dev.usbharu.hideout.core.application.domainevent.subscribers import dev.usbharu.hideout.core.domain.event.post.PostEvent import dev.usbharu.hideout.core.domain.event.post.PostEventBody import org.slf4j.LoggerFactory -import org.springframework.context.annotation.Scope import org.springframework.stereotype.Component @Component -class TimelinePostCreateSubscriber(domainEventSubscriber: DomainEventSubscriber) :Subscriber{ +class TimelinePostCreateSubscriber(domainEventSubscriber: DomainEventSubscriber) : Subscriber { init { domainEventSubscriber.subscribe(PostEvent.CREATE.eventName) { val post = it.body.getPost() val actor = it.body.getActor() - logger.info("New Post! : {}",post) - + logger.info("New Post! : {}", post) } } - companion object{ + companion object { private val logger = LoggerFactory.getLogger(TimelinePostCreateSubscriber::class.java) } } diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/config/FlywayConfig.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/config/FlywayConfig.kt index ac4469c5..15133cdb 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/config/FlywayConfig.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/config/FlywayConfig.kt @@ -13,4 +13,4 @@ class FlywayConfig { migrate.migrate() } } -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/event/actorinstancerelationship/ActorInstanceRelationshipEvent.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/event/actorinstancerelationship/ActorInstanceRelationshipEvent.kt index ada2287e..aabdd14a 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/event/actorinstancerelationship/ActorInstanceRelationshipEvent.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/event/actorinstancerelationship/ActorInstanceRelationshipEvent.kt @@ -21,7 +21,9 @@ import dev.usbharu.hideout.core.domain.shared.domainevent.DomainEvent import dev.usbharu.hideout.core.domain.shared.domainevent.DomainEventBody class ActorInstanceRelationshipDomainEventFactory(private val actorInstanceRelationship: ActorInstanceRelationship) { - fun createEvent(actorInstanceRelationshipEvent: ActorInstanceRelationshipEvent): DomainEvent { + fun createEvent( + actorInstanceRelationshipEvent: ActorInstanceRelationshipEvent + ): DomainEvent { return DomainEvent.create( actorInstanceRelationshipEvent.eventName, ActorInstanceRelationshipEventBody(actorInstanceRelationship) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/event/timeline/TimelineEvent.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/event/timeline/TimelineEvent.kt index 781752fe..a6d53cf6 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/event/timeline/TimelineEvent.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/event/timeline/TimelineEvent.kt @@ -13,4 +13,4 @@ class TimelineEventBody(timeline: Timeline) : DomainEventBody(mapOf("timeline" t enum class TimelineEvent(val eventName: String) { CHANGE_VISIBILITY("ChangeVisibility") -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/followtimeline/FollowTimeline.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/followtimeline/FollowTimeline.kt index b774482c..c5340618 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/followtimeline/FollowTimeline.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/followtimeline/FollowTimeline.kt @@ -3,4 +3,4 @@ package dev.usbharu.hideout.core.domain.model.followtimeline import dev.usbharu.hideout.core.domain.model.timeline.TimelineId import dev.usbharu.hideout.core.domain.model.userdetails.UserDetailId -class FollowTimeline(val userDetailId: UserDetailId, val timelineId: TimelineId) \ No newline at end of file +class FollowTimeline(val userDetailId: UserDetailId, val timelineId: TimelineId) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/followtimeline/FollowTimelineRepository.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/followtimeline/FollowTimelineRepository.kt index 8c0ebd5e..9c7bc104 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/followtimeline/FollowTimelineRepository.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/followtimeline/FollowTimelineRepository.kt @@ -3,4 +3,4 @@ package dev.usbharu.hideout.core.domain.model.followtimeline interface FollowTimelineRepository { suspend fun save(followTimeline: FollowTimeline): FollowTimeline suspend fun delete(followTimeline: FollowTimeline) -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/post/Post.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/post/Post.kt index 9bab7777..0813a34a 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/post/Post.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/post/Post.kt @@ -50,7 +50,6 @@ class Post( moveTo: PostId?, ) : DomainEventStorable() { - val actorId = actorId get() { if (deleted) { @@ -271,7 +270,6 @@ class Post( ")" } - companion object { @Suppress("LongParameterList") fun create( diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepository.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepository.kt index e21f588a..1e854326 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepository.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepository.kt @@ -29,11 +29,10 @@ interface RelationshipRepository { ): List } - data class FindRelationshipOption( val follow: Boolean? = null, val block: Boolean? = null, val mute: Boolean? = null, val followRequest: Boolean? = null, val muteFollowRequest: Boolean? = null -) \ No newline at end of file +) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/page/Page.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/page/Page.kt index 9065855f..88ef63a5 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/page/Page.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/page/Page.kt @@ -43,4 +43,4 @@ sealed class Page { ) } } -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/page/PaginationList.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/page/PaginationList.kt index 9b4eedcb..617ceecb 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/page/PaginationList.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/page/PaginationList.kt @@ -1,3 +1,3 @@ package dev.usbharu.hideout.core.domain.model.support.page -class PaginationList(list: List, val next: ID?, val prev: ID?) : List by list \ No newline at end of file +class PaginationList(list: List, val next: ID?, val prev: ID?) : List by list 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 index a05ce174..5126aa35 100644 --- 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 @@ -19,4 +19,4 @@ data class PostDetail( require(reply?.actorId == replyActor?.id) require(repost?.actorId == repostActor?.id) } -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/timelineobjectdetail/TimelineObjectDetail.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/timelineobjectdetail/TimelineObjectDetail.kt index 3a0d15f9..e5d49aa5 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/timelineobjectdetail/TimelineObjectDetail.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/support/timelineobjectdetail/TimelineObjectDetail.kt @@ -50,4 +50,4 @@ data class TimelineObjectDetail( ) } } -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/Timeline.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/Timeline.kt index e3fe6f74..955b1621 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/Timeline.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/Timeline.kt @@ -25,4 +25,4 @@ class Timeline( var name = name private set -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/TimelineRepository.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/TimelineRepository.kt index a2d484b6..28fdb0f1 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/TimelineRepository.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/TimelineRepository.kt @@ -7,4 +7,4 @@ interface TimelineRepository { suspend fun findByIds(ids: List): List suspend fun findById(id: TimelineId): Timeline? -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/TimelineVisibility.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/TimelineVisibility.kt index caf78558..506dd3af 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/TimelineVisibility.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timeline/TimelineVisibility.kt @@ -4,4 +4,4 @@ enum class TimelineVisibility { PRIVATE, UNLISTED, PUBLIC -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelineobject/TimelineObject.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelineobject/TimelineObject.kt index 5f8feba1..171fcc01 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelineobject/TimelineObject.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelineobject/TimelineObject.kt @@ -110,7 +110,6 @@ class TimelineObject( repost: Post, filterResults: List ): TimelineObject { - require(post.repostId == repost.id) return TimelineObject( @@ -138,4 +137,4 @@ class TimelineObject( ) } } -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelineobject/TimelineObjectWarnFilter.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelineobject/TimelineObjectWarnFilter.kt index 5ca80ae1..6950d4e9 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelineobject/TimelineObjectWarnFilter.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelineobject/TimelineObjectWarnFilter.kt @@ -2,6 +2,4 @@ package dev.usbharu.hideout.core.domain.model.timelineobject import dev.usbharu.hideout.core.domain.model.filter.FilterId -class TimelineObjectWarnFilter(val filterId: FilterId, val matchedKeyword: String) { - -} +class TimelineObjectWarnFilter(val filterId: FilterId, val matchedKeyword: String) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelinerelationship/TimelineRelationship.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelinerelationship/TimelineRelationship.kt index 77b621d2..df2cf099 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelinerelationship/TimelineRelationship.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelinerelationship/TimelineRelationship.kt @@ -15,4 +15,4 @@ enum class Visible { UNLISTED, FOLLOWERS, DIRECT -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelinerelationship/TimelineRelationshipRepository.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelinerelationship/TimelineRelationshipRepository.kt index 1fa75c6d..ccf1c463 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelinerelationship/TimelineRelationshipRepository.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/domain/model/timelinerelationship/TimelineRelationshipRepository.kt @@ -7,4 +7,4 @@ interface TimelineRelationshipRepository { suspend fun delete(timelineRelationship: TimelineRelationship) suspend fun findByActorId(actorId: ActorId): List -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/timeline/TimelineStore.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/timeline/TimelineStore.kt index 64b6c0b6..2c9d5296 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/timeline/TimelineStore.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/external/timeline/TimelineStore.kt @@ -17,4 +17,4 @@ interface TimelineStore { suspend fun removeTimeline(timeline: Timeline) suspend fun readTimeline(timeline: Timeline): List -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedPostRepository.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedPostRepository.kt index e400527c..e9b09eba 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedPostRepository.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedPostRepository.kt @@ -171,17 +171,20 @@ class ExposedPostRepository( } .let(postQueryMapper::map) } - } - override suspend fun findByActorId(id: ActorId, page: Page?): PaginationList = PaginationList(query { - Posts - .selectAll() - .where { - actorId eq actorId - } - .let(postQueryMapper::map) - }, null, null) + override suspend fun findByActorId(id: ActorId, page: Page?): PaginationList = PaginationList( + query { + Posts + .selectAll() + .where { + actorId eq actorId + } + .let(postQueryMapper::map) + }, + null, + null + ) override suspend fun delete(post: Post) { query { @@ -197,14 +200,18 @@ class ExposedPostRepository( visibilityList: List, of: Page? ): PaginationList { - return PaginationList(query { - Posts - .selectAll() - .where { - Posts.actorId eq actorId.id and (visibility inList visibilityList.map { it.name }) - } - .let(postQueryMapper::map) - }, null, null) + return PaginationList( + query { + Posts + .selectAll() + .where { + Posts.actorId eq actorId.id and (visibility inList visibilityList.map { it.name }) + } + .let(postQueryMapper::map) + }, + null, + null + ) } companion object { diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedRelationshipRepository.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedRelationshipRepository.kt index bd811773..8de364aa 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedRelationshipRepository.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedRelationshipRepository.kt @@ -74,7 +74,7 @@ class ExposedRelationshipRepository(override val domainEventPublisher: DomainEve ): List { val query1 = Relationships.selectAll().where { Relationships.actorId eq targetId.id } inverseOption.apply(query1) - //todo 逆のほうがいいかも + // todo 逆のほうがいいかも val query = query1.alias("INV").selectAll().where { Relationships.targetActorId eq targetId.id } @@ -89,7 +89,6 @@ class ExposedRelationshipRepository(override val domainEventPublisher: DomainEve } fun FindRelationshipOption?.apply(query: Query) { - if (this?.follow != null) { query.andWhere { Relationships.following eq this@apply.follow } } diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedTimelineRelationshipRepository.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedTimelineRelationshipRepository.kt index abfdd8be..e501f9eb 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedTimelineRelationshipRepository.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedTimelineRelationshipRepository.kt @@ -65,4 +65,4 @@ object TimelineRelationships : Table("timeline_relationships") { val actorId = long("actor_id").references(Actors.id) val visible = varchar("visible", 100) override val primaryKey: PrimaryKey = PrimaryKey(id) -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedTimelineRepository.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedTimelineRepository.kt index 2d8b390f..ecf93bb1 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedTimelineRepository.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedTimelineRepository.kt @@ -11,8 +11,10 @@ import org.slf4j.LoggerFactory import org.springframework.stereotype.Repository @Repository -class ExposedTimelineRepository(override val domainEventPublisher: DomainEventPublisher) : TimelineRepository, - AbstractRepository(), DomainEventPublishableRepository { +class ExposedTimelineRepository(override val domainEventPublisher: DomainEventPublisher) : + TimelineRepository, + AbstractRepository(), + DomainEventPublishableRepository { override suspend fun save(timeline: Timeline): Timeline { query { Timelines.insert { @@ -54,7 +56,6 @@ class ExposedTimelineRepository(override val domainEventPublisher: DomainEventPu override val logger: Logger get() = Companion.logger - } fun ResultRow.toTimeline(): Timeline { @@ -75,4 +76,4 @@ object Timelines : Table("timelines") { val isSystem = bool("is_system") override val primaryKey: PrimaryKey = PrimaryKey(id) -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/mongorepository/MongoInternalTimelineObjectRepository.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/mongorepository/MongoInternalTimelineObjectRepository.kt index 5526687f..71404c27 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/mongorepository/MongoInternalTimelineObjectRepository.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/mongorepository/MongoInternalTimelineObjectRepository.kt @@ -22,7 +22,9 @@ import org.springframework.stereotype.Repository import java.time.Instant @Repository -class MongoInternalTimelineObjectRepository(private val springDataMongoTimelineObjectRepository: SpringDataMongoTimelineObjectRepository) : +class MongoInternalTimelineObjectRepository( + private val springDataMongoTimelineObjectRepository: SpringDataMongoTimelineObjectRepository +) : InternalTimelineObjectRepository { override suspend fun save(timelineObject: TimelineObject): TimelineObject { springDataMongoTimelineObjectRepository.save(SpringDataMongoTimelineObject.of(timelineObject)) @@ -55,8 +57,6 @@ class MongoInternalTimelineObjectRepository(private val springDataMongoTimelineO return springDataMongoTimelineObjectRepository.findByTimelineId(timelineId).map { it.toTimelineObject() } .toList() } - - } @Document @@ -162,4 +162,4 @@ interface SpringDataMongoTimelineObjectRepository : CoroutineCrudRepository -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/domainevent/SpringFrameworkDomainEventSubscriber.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/domainevent/SpringFrameworkDomainEventSubscriber.kt index a3cd4f2d..2fe7e39e 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/domainevent/SpringFrameworkDomainEventSubscriber.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/domainevent/SpringFrameworkDomainEventSubscriber.kt @@ -21,8 +21,7 @@ class SpringFrameworkDomainEventSubscriber : DomainEventSubscriber { map[domainEvent.name]?.forEach { try { it.invoke(domainEvent) - } - catch (e: Exception) { + } catch (e: Exception) { } } } diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/timeline/AbstractTimelineStore.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/timeline/AbstractTimelineStore.kt index 5f25d29c..bd91f5b8 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/timeline/AbstractTimelineStore.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/timeline/AbstractTimelineStore.kt @@ -72,7 +72,11 @@ abstract class AbstractTimelineStore(private val idGenerateService: IdGenerateSe } return TimelineObject.create( - TimelineObjectId(idGenerateService.generateId()), timeline, post, replyActorId, applyFilters.filterResults + TimelineObjectId(idGenerateService.generateId()), + timeline, + post, + replyActorId, + applyFilters.filterResults ) } @@ -198,12 +202,20 @@ abstract class AbstractTimelineStore(private val idGenerateService: IdGenerateSe val newerFilters = getNewerFilters(timeline.userDetailId, lastUpdatedAt) val posts = - getPostsByPostId(timelineObjectList.map { it.postId } + timelineObjectList.mapNotNull { it.repostId } + timelineObjectList.mapNotNull { it.replyId }) + getPostsByPostId( + timelineObjectList.map { + it.postId + } + timelineObjectList.mapNotNull { it.repostId } + timelineObjectList.mapNotNull { it.replyId } + ) val userDetails = getUserDetails(timelineObjectList.map { it.userDetailId }) val actors = - getActors(timelineObjectList.map { it.postActorId } + timelineObjectList.mapNotNull { it.repostActorId } + timelineObjectList.mapNotNull { it.replyActorId }) + getActors( + timelineObjectList.map { + it.postActorId + } + timelineObjectList.mapNotNull { it.repostActorId } + timelineObjectList.mapNotNull { it.replyActorId } + ) val postMap = posts.associate { post -> post.id to applyFilters(post, newerFilters) @@ -239,4 +251,4 @@ abstract class AbstractTimelineStore(private val idGenerateService: IdGenerateSe abstract suspend fun getActors(actorIds: List): Map abstract suspend fun getUserDetails(userDetailIdList: List): Map -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/timeline/DefaultTimelineStore.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/timeline/DefaultTimelineStore.kt index 038125c8..f0015cdf 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/timeline/DefaultTimelineStore.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/timeline/DefaultTimelineStore.kt @@ -120,4 +120,4 @@ open class DefaultTimelineStore( override suspend fun getUserDetails(userDetailIdList: List): Map { return userDetailRepository.findAllById(userDetailIdList).associateBy { it.id } } -} \ No newline at end of file +} diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/timeline/InternalTimelineObjectRepository.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/timeline/InternalTimelineObjectRepository.kt index c0a434ad..71e5a71c 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/timeline/InternalTimelineObjectRepository.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/timeline/InternalTimelineObjectRepository.kt @@ -18,4 +18,4 @@ interface InternalTimelineObjectRepository { suspend fun deleteByTimelineId(timelineId: TimelineId) suspend fun findByTimelineId(timelineId: TimelineId): List -} \ No newline at end of file +}