From 3bef01a955774d3d791b7c075c9eb9ec2d2a1dd5 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Fri, 11 Aug 2023 16:06:12 +0900 Subject: [PATCH] =?UTF-8?q?style:=20=E3=82=B9=E3=82=BF=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../usbharu/hideout/query/UserQueryServiceImpl.kt | 5 ++--- .../usbharu/hideout/routing/api/internal/v1/Users.kt | 2 +- .../hideout/service/api/PostApiServiceImpl.kt | 12 ++++++------ .../dev/usbharu/kjob/exposed/ExposedJobRepository.kt | 2 ++ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/query/UserQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/query/UserQueryServiceImpl.kt index 3e1e80fe..41042d8f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/UserQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/query/UserQueryServiceImpl.kt @@ -25,7 +25,6 @@ class UserQueryServiceImpl : UserQueryService { override suspend fun findByIds(ids: List): List = Users.select { Users.id inList ids }.map { it.toUser() } - override suspend fun existByNameAndDomain(name: String, domain: String): Boolean { - return Users.select { Users.name eq name and (Users.domain eq domain) }.empty().not() - } + override suspend fun existByNameAndDomain(name: String, domain: String): Boolean = + Users.select { Users.name eq name and (Users.domain eq domain) }.empty().not() } diff --git a/src/main/kotlin/dev/usbharu/hideout/routing/api/internal/v1/Users.kt b/src/main/kotlin/dev/usbharu/hideout/routing/api/internal/v1/Users.kt index 5a90ea7b..6bf0e5ad 100644 --- a/src/main/kotlin/dev/usbharu/hideout/routing/api/internal/v1/Users.kt +++ b/src/main/kotlin/dev/usbharu/hideout/routing/api/internal/v1/Users.kt @@ -16,7 +16,7 @@ import io.ktor.server.request.* import io.ktor.server.response.* import io.ktor.server.routing.* -@Suppress("LongMethod") +@Suppress("LongMethod", "CognitiveComplexMethod") fun Route.users(userService: IUserService, userApiService: IUserApiService) { route("/users") { get { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/PostApiServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/api/PostApiServiceImpl.kt index fe00e680..ee08b7d9 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/PostApiServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/api/PostApiServiceImpl.kt @@ -52,12 +52,12 @@ class PostApiServiceImpl( userId: Long? ): List = transaction.transaction { postResponseQueryService.findAll( - since?.toEpochMilli(), - until?.toEpochMilli(), - minId, - maxId, - limit, - userId + since = since?.toEpochMilli(), + until = until?.toEpochMilli(), + minId = minId, + maxId = maxId, + limit = limit, + userId = userId ) } diff --git a/src/main/kotlin/dev/usbharu/kjob/exposed/ExposedJobRepository.kt b/src/main/kotlin/dev/usbharu/kjob/exposed/ExposedJobRepository.kt index c9ff10c5..419aec37 100644 --- a/src/main/kotlin/dev/usbharu/kjob/exposed/ExposedJobRepository.kt +++ b/src/main/kotlin/dev/usbharu/kjob/exposed/ExposedJobRepository.kt @@ -202,6 +202,7 @@ class ExposedJobRepository( } } + @Suppress("CyclomaticComplexMethod") private fun String?.parseJsonMap(): Map { this ?: return emptyMap() return json.parseToJsonElement(this).jsonObject.mapValues { (_, el) -> @@ -232,6 +233,7 @@ class ExposedJobRepository( } } + @Suppress("CyclomaticComplexMethod") private fun Map.stringify(): String? { if (isEmpty()) { return null