mirror of https://github.com/usbharu/Hideout.git
Merge pull request #598 from usbharu/renovate/detekt
chore(deps): update detekt to v1.23.7
This commit is contained in:
commit
d8961464cc
|
@ -16,12 +16,12 @@ data class Reactions(
|
||||||
fun of(reactionList: List<Reaction>, customEmoji: CustomEmoji?): Reactions {
|
fun of(reactionList: List<Reaction>, customEmoji: CustomEmoji?): Reactions {
|
||||||
val first = reactionList.first()
|
val first = reactionList.first()
|
||||||
return Reactions(
|
return Reactions(
|
||||||
first.id.value,
|
postId = first.id.value,
|
||||||
reactionList.size,
|
count = reactionList.size,
|
||||||
customEmoji?.name ?: first.unicodeEmoji.name,
|
name = customEmoji?.name ?: first.unicodeEmoji.name,
|
||||||
customEmoji?.domain?.domain ?: first.unicodeEmoji.domain.domain,
|
domain = customEmoji?.domain?.domain ?: first.unicodeEmoji.domain.domain,
|
||||||
customEmoji?.url,
|
url = customEmoji?.url,
|
||||||
reactionList.map { it.actorId.id }
|
actorIds = reactionList.map { it.actorId.id }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,10 @@ class ReadTimelineApplicationService(
|
||||||
val reply = if (it.replyPost != null) {
|
val reply = if (it.replyPost != null) {
|
||||||
@Suppress("UnsafeCallOnNullableType")
|
@Suppress("UnsafeCallOnNullableType")
|
||||||
PostDetail.of(
|
PostDetail.of(
|
||||||
it.replyPost,
|
post = it.replyPost,
|
||||||
it.replyPostActor!!,
|
actor = it.replyPostActor!!,
|
||||||
it.replyPostActorIconMedia,
|
iconMedia = it.replyPostActorIconMedia,
|
||||||
it.replyPostMedias.orEmpty(),
|
mediaList = it.replyPostMedias.orEmpty(),
|
||||||
reactionsList = emptyList(),
|
reactionsList = emptyList(),
|
||||||
favourited = false,
|
favourited = false,
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,15 +27,14 @@ class Reaction(
|
||||||
return id == other.id
|
return id == other.id
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int = id.hashCode()
|
||||||
return id.hashCode()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun delete() {
|
fun delete() {
|
||||||
addDomainEvent(ReactionEventFactory(this).createEvent(ReactionEvent.DELETE))
|
addDomainEvent(ReactionEventFactory(this).createEvent(ReactionEvent.DELETE))
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@Suppress("LongParameterList")
|
||||||
fun create(
|
fun create(
|
||||||
id: ReactionId,
|
id: ReactionId,
|
||||||
postId: PostId,
|
postId: PostId,
|
||||||
|
|
|
@ -4,6 +4,7 @@ import dev.usbharu.hideout.core.domain.model.actor.ActorId
|
||||||
import dev.usbharu.hideout.core.domain.model.emoji.CustomEmojiId
|
import dev.usbharu.hideout.core.domain.model.emoji.CustomEmojiId
|
||||||
import dev.usbharu.hideout.core.domain.model.post.PostId
|
import dev.usbharu.hideout.core.domain.model.post.PostId
|
||||||
|
|
||||||
|
@Suppress("FunctionMaxLength")
|
||||||
interface ReactionRepository {
|
interface ReactionRepository {
|
||||||
suspend fun save(reaction: Reaction): Reaction
|
suspend fun save(reaction: Reaction): Reaction
|
||||||
suspend fun findById(reactionId: ReactionId): Reaction?
|
suspend fun findById(reactionId: ReactionId): Reaction?
|
||||||
|
|
|
@ -9,6 +9,8 @@ interface TimelineRepository {
|
||||||
suspend fun findByIds(ids: List<TimelineId>): List<Timeline>
|
suspend fun findByIds(ids: List<TimelineId>): List<Timeline>
|
||||||
|
|
||||||
suspend fun findById(id: TimelineId): Timeline?
|
suspend fun findById(id: TimelineId): Timeline?
|
||||||
|
|
||||||
|
@Suppress("FunctionMaxLength")
|
||||||
suspend fun findAllByUserDetailIdAndVisibilityIn(
|
suspend fun findAllByUserDetailIdAndVisibilityIn(
|
||||||
userDetailId: UserDetailId,
|
userDetailId: UserDetailId,
|
||||||
visibility: List<TimelineVisibility>
|
visibility: List<TimelineVisibility>
|
||||||
|
|
|
@ -18,9 +18,7 @@ class TimelineRelationship(
|
||||||
return id == other.id
|
return id == other.id
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int = id.hashCode()
|
||||||
return id.hashCode()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class Visible {
|
enum class Visible {
|
||||||
|
|
|
@ -6,7 +6,5 @@ import org.springframework.stereotype.Service
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
class EmojiKtUnicodeEmojiService : UnicodeEmojiService {
|
class EmojiKtUnicodeEmojiService : UnicodeEmojiService {
|
||||||
override fun isUnicodeEmoji(emoji: String): Boolean {
|
override fun isUnicodeEmoji(emoji: String): Boolean = Emojis.allEmojis.singleOrNull { it.char == emoji } != null
|
||||||
return Emojis.allEmojis.singleOrNull { it.char == emoji } != null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,9 @@ import dev.usbharu.hideout.core.infrastructure.exposedrepository.Reactions as Ex
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
class ExposedReactionsQueryService : ReactionsQueryService, AbstractRepository() {
|
class ExposedReactionsQueryService : ReactionsQueryService, AbstractRepository() {
|
||||||
|
override val logger: Logger
|
||||||
|
get() = Companion.logger
|
||||||
|
|
||||||
override suspend fun findAllByPostId(postId: PostId): List<Reactions> {
|
override suspend fun findAllByPostId(postId: PostId): List<Reactions> {
|
||||||
return query {
|
return query {
|
||||||
ExposedrepositoryReactions.leftJoin(CustomEmojis).selectAll()
|
ExposedrepositoryReactions.leftJoin(CustomEmojis).selectAll()
|
||||||
|
@ -52,21 +55,18 @@ class ExposedReactionsQueryService : ReactionsQueryService, AbstractRepository()
|
||||||
.groupBy(ExposedrepositoryReactions.postId)
|
.groupBy(ExposedrepositoryReactions.postId)
|
||||||
.map {
|
.map {
|
||||||
Reactions(
|
Reactions(
|
||||||
it[ExposedrepositoryReactions.postId],
|
postId = it[ExposedrepositoryReactions.postId],
|
||||||
it[ExposedrepositoryReactions.postId.count()].toInt(),
|
count = it[ExposedrepositoryReactions.postId.count()].toInt(),
|
||||||
it.getOrNull(CustomEmojis.name)
|
name = it.getOrNull(CustomEmojis.name)
|
||||||
?: it[ExposedrepositoryReactions.unicodeEmoji.max<String, String>()]!!,
|
?: it[ExposedrepositoryReactions.unicodeEmoji.max<String, String>()]!!,
|
||||||
it.getOrNull(CustomEmojis.domain) ?: UnicodeEmoji.domain.domain,
|
domain = it.getOrNull(CustomEmojis.domain) ?: UnicodeEmoji.domain.domain,
|
||||||
it.getOrNull(CustomEmojis.url)?.let { it1 -> URI.create(it1) },
|
url = it.getOrNull(CustomEmojis.url)?.let { it1 -> URI.create(it1) },
|
||||||
it[actorIdsQuery].split(",").mapNotNull { it.toLongOrNull() }
|
actorIds = it[actorIdsQuery].split(",").mapNotNull { s -> s.toLongOrNull() }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override val logger: Logger
|
|
||||||
get() = Companion.logger
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val logger = LoggerFactory.getLogger(ExposedReactionsQueryService::class.java)
|
private val logger = LoggerFactory.getLogger(ExposedReactionsQueryService::class.java)
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class ExposedUserTimelineQueryService : UserTimelineQueryService, AbstractReposi
|
||||||
mediaDetailList = it.mapNotNull { resultRow ->
|
mediaDetailList = it.mapNotNull { resultRow ->
|
||||||
resultRow.toMediaOrNull()?.let { it1 -> MediaDetail.of(it1) }
|
resultRow.toMediaOrNull()?.let { it1 -> MediaDetail.of(it1) }
|
||||||
},
|
},
|
||||||
favourited = it.any { it.getOrNull(Reactions.actorId) != null }
|
favourited = it.any { resultRow -> resultRow.getOrNull(Reactions.actorId) != null }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ class ExposedUserTimelineQueryService : UserTimelineQueryService, AbstractReposi
|
||||||
deleted = it[authorizedQuery[Posts.deleted]],
|
deleted = it[authorizedQuery[Posts.deleted]],
|
||||||
mediaDetailList = emptyList(),
|
mediaDetailList = emptyList(),
|
||||||
moveTo = null,
|
moveTo = null,
|
||||||
emptyList(),
|
reactionsList = emptyList(),
|
||||||
favourited = false
|
favourited = false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,12 +108,12 @@ class ExposedReactionRepository(override val domainEventPublisher: DomainEventPu
|
||||||
|
|
||||||
fun ResultRow.toReaction(): Reaction {
|
fun ResultRow.toReaction(): Reaction {
|
||||||
return Reaction(
|
return Reaction(
|
||||||
ReactionId(this[Reactions.id]),
|
id = ReactionId(this[Reactions.id]),
|
||||||
PostId(this[Reactions.postId]),
|
postId = PostId(this[Reactions.postId]),
|
||||||
ActorId(this[Reactions.actorId]),
|
actorId = ActorId(this[Reactions.actorId]),
|
||||||
this[Reactions.customEmojiId]?.let { CustomEmojiId(it) },
|
customEmojiId = this[Reactions.customEmojiId]?.let { CustomEmojiId(it) },
|
||||||
UnicodeEmoji(this[Reactions.unicodeEmoji]),
|
unicodeEmoji = UnicodeEmoji(this[Reactions.unicodeEmoji]),
|
||||||
this[Reactions.createdAt]
|
createdAt = this[Reactions.createdAt]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,9 +160,8 @@ open class DefaultTimelineStore(
|
||||||
override suspend fun getMedias(mediaIds: List<MediaId>): Map<MediaId, Media> =
|
override suspend fun getMedias(mediaIds: List<MediaId>): Map<MediaId, Media> =
|
||||||
mediaRepository.findByIds(mediaIds).associateBy { it.id }
|
mediaRepository.findByIds(mediaIds).associateBy { it.id }
|
||||||
|
|
||||||
override suspend fun getReactions(postIds: List<PostId>): Map<PostId, List<Reactions>> {
|
override suspend fun getReactions(postIds: List<PostId>): Map<PostId, List<Reactions>> =
|
||||||
return reactionsQueryService.findAllByPostIdIn(postIds).groupBy { PostId(it.postId) }
|
reactionsQueryService.findAllByPostIdIn(postIds).groupBy { PostId(it.postId) }
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun getUserDetails(userDetailIdList: List<UserDetailId>): Map<UserDetailId, UserDetail> =
|
override suspend fun getUserDetails(userDetailIdList: List<UserDetailId>): Map<UserDetailId, UserDetail> =
|
||||||
userDetailRepository.findAllById(userDetailIdList).associateBy { it.id }
|
userDetailRepository.findAllById(userDetailIdList).associateBy { it.id }
|
||||||
|
|
|
@ -4,7 +4,7 @@ kotlin = "2.0.20"
|
||||||
ktor = "2.3.12"
|
ktor = "2.3.12"
|
||||||
exposed = "0.54.0"
|
exposed = "0.54.0"
|
||||||
javacv-ffmpeg = "6.1.1-1.5.10"
|
javacv-ffmpeg = "6.1.1-1.5.10"
|
||||||
detekt = "1.23.6"
|
detekt = "1.23.7"
|
||||||
coroutines = "1.8.1"
|
coroutines = "1.8.1"
|
||||||
swagger = "2.2.23"
|
swagger = "2.2.23"
|
||||||
tika = "2.9.2"
|
tika = "2.9.2"
|
||||||
|
|
Loading…
Reference in New Issue