style: fix lint

This commit is contained in:
usbharu 2024-07-20 16:23:59 +09:00
parent edae599978
commit 8e84c8e59c
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
31 changed files with 80 additions and 70 deletions

View File

@ -1,4 +1,3 @@
package dev.usbharu.hideout.core.application.domainevent.subscribers
interface Subscriber {
}
interface Subscriber

View File

@ -7,6 +7,5 @@ import org.springframework.stereotype.Component
@Component
class SubscriberRunner(subscribers: List<Subscriber>) : ApplicationRunner {
override fun run(args: ApplicationArguments?) {
}
}

View File

@ -3,7 +3,6 @@ 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
@ -14,7 +13,6 @@ class TimelinePostCreateSubscriber(domainEventSubscriber: DomainEventSubscriber)
val actor = it.body.getActor()
logger.info("New Post! : {}", post)
}
}

View File

@ -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<ActorInstanceRelationshipEventBody> {
fun createEvent(
actorInstanceRelationshipEvent: ActorInstanceRelationshipEvent
): DomainEvent<ActorInstanceRelationshipEventBody> {
return DomainEvent.create(
actorInstanceRelationshipEvent.eventName,
ActorInstanceRelationshipEventBody(actorInstanceRelationship)

View File

@ -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(

View File

@ -29,7 +29,6 @@ interface RelationshipRepository {
): List<Relationship>
}
data class FindRelationshipOption(
val follow: Boolean? = null,
val block: Boolean? = null,

View File

@ -110,7 +110,6 @@ class TimelineObject(
repost: Post,
filterResults: List<FilterResult>
): TimelineObject {
require(post.repostId == repost.id)
return TimelineObject(

View File

@ -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)

View File

@ -171,17 +171,20 @@ class ExposedPostRepository(
}
.let(postQueryMapper::map)
}
}
override suspend fun findByActorId(id: ActorId, page: Page?): PaginationList<Post, PostId> = PaginationList(query {
override suspend fun findByActorId(id: ActorId, page: Page?): PaginationList<Post, PostId> = PaginationList(
query {
Posts
.selectAll()
.where {
actorId eq actorId
}
.let(postQueryMapper::map)
}, null, null)
},
null,
null
)
override suspend fun delete(post: Post) {
query {
@ -197,14 +200,18 @@ class ExposedPostRepository(
visibilityList: List<Visibility>,
of: Page?
): PaginationList<Post, PostId> {
return PaginationList(query {
return PaginationList(
query {
Posts
.selectAll()
.where {
Posts.actorId eq actorId.id and (visibility inList visibilityList.map { it.name })
}
.let(postQueryMapper::map)
}, null, null)
},
null,
null
)
}
companion object {

View File

@ -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 }
}

View File

@ -11,8 +11,10 @@ import org.slf4j.LoggerFactory
import org.springframework.stereotype.Repository
@Repository
class ExposedTimelineRepository(override val domainEventPublisher: DomainEventPublisher) : TimelineRepository,
AbstractRepository(), DomainEventPublishableRepository<Timeline> {
class ExposedTimelineRepository(override val domainEventPublisher: DomainEventPublisher) :
TimelineRepository,
AbstractRepository(),
DomainEventPublishableRepository<Timeline> {
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 {

View File

@ -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

View File

@ -21,8 +21,7 @@ class SpringFrameworkDomainEventSubscriber : DomainEventSubscriber {
map[domainEvent.name]?.forEach {
try {
it.invoke(domainEvent)
}
catch (e: Exception) {
} catch (e: Exception) {
}
}
}

View File

@ -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)