From 2784410687d18f2b8dc8d6b4aa59b738f5d128bc Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Sun, 4 Feb 2024 15:07:32 +0900 Subject: [PATCH 1/6] =?UTF-8?q?chore:=20=E3=81=A8=E3=82=8A=E3=81=82?= =?UTF-8?q?=E3=81=88=E3=81=9Awindows=E3=81=A8linux=E3=81=AEx86=5F64?= =?UTF-8?q?=E3=81=A7=E3=81=AE=E3=81=BF=E5=8B=95=E3=81=8F=E7=94=A8=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 14213211..ca1ad77c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -169,6 +169,9 @@ sourceSets.main { ) } +val os = org.gradle.nativeplatform.platform.internal + .DefaultNativePlatform.getCurrentOperatingSystem() + dependencies { implementation("io.ktor:ktor-serialization-jackson:$ktor_version") implementation("org.jetbrains.exposed:exposed-core:$exposed_version") @@ -211,7 +214,22 @@ dependencies { implementation("org.apache.tika:tika-core:2.9.1") implementation("org.apache.tika:tika-parsers:2.9.1") implementation("net.coobird:thumbnailator:0.4.20") - implementation("org.bytedeco:javacv-platform:1.5.9") + implementation("org.bytedeco:javacv:1.5.10"){ + exclude(module = "opencv") + exclude(module = "flycapture") + exclude(module = "artoolkitplus") + exclude(module = "libdc1394") + exclude(module = "librealsense") + exclude(module = "librealsense2") + exclude(module = "tesseract") + exclude(module = "libfreenect") + exclude(module = "libfreenect2") + } + if (os.isWindows) { + implementation("org.bytedeco","ffmpeg","6.1.1-1.5.10", classifier = "windows-x86_64") + }else{ + implementation("org.bytedeco","ffmpeg","6.1.1-1.5.10", classifier = "linux-x86_64") + } implementation("org.flywaydb:flyway-core") implementation("dev.usbharu:emoji-kt:2.0.0") From 78f0453a91e7b20502623e1fcd06a31d8c747243 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Sun, 4 Feb 2024 16:00:58 +0900 Subject: [PATCH 2/6] =?UTF-8?q?chore:=20=E4=BE=9D=E5=AD=98=E9=96=A2?= =?UTF-8?q?=E4=BF=82=E3=82=92=E3=82=A2=E3=83=83=E3=83=97=E3=83=87=E3=83=BC?= =?UTF-8?q?=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 56 ++++++++++++------------ gradle.properties | 13 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index ca1ad77c..fb4fadd8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,16 +7,17 @@ val logback_version: String by project val exposed_version: String by project val h2_version: String by project val koin_version: String by project +val coroutines_version: String by project +val serialization_version: String by project plugins { - kotlin("jvm") version "1.8.21" - id("org.graalvm.buildtools.native") version "0.9.21" - id("io.gitlab.arturbosch.detekt") version "1.23.1" - id("org.springframework.boot") version "3.2.0" - kotlin("plugin.spring") version "1.8.21" - id("org.openapi.generator") version "7.0.1" + kotlin("jvm") version "1.9.22" + id("org.graalvm.buildtools.native") version "0.10.0" + id("io.gitlab.arturbosch.detekt") version "1.23.5" + id("org.springframework.boot") version "3.2.2" + kotlin("plugin.spring") version "1.9.22" + id("org.openapi.generator") version "7.2.0" id("org.jetbrains.kotlinx.kover") version "0.7.4" -// id("org.jetbrains.kotlin.plugin.serialization") version "1.8.10" } apply { @@ -91,8 +92,8 @@ tasks.withType { } tasks.withType>().configureEach { - compilerOptions.languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_8) - compilerOptions.apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_8) + compilerOptions.languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9) + compilerOptions.apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9) } tasks.withType { @@ -156,7 +157,7 @@ repositories { kotlin { target { compilations.all { - kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString() + kotlinOptions.jvmTarget = JavaVersion.VERSION_21.toString() } } } @@ -177,11 +178,10 @@ dependencies { implementation("org.jetbrains.exposed:exposed-core:$exposed_version") implementation("org.jetbrains.exposed:exposed-jdbc:$exposed_version") implementation("com.h2database:h2:$h2_version") - implementation("org.xerial:sqlite-jdbc:3.40.1.0") + implementation("org.xerial:sqlite-jdbc:3.45.1.0") implementation("ch.qos.logback:logback-classic:$logback_version") - implementation("com.auth0:java-jwt:4.4.0") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.0") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serialization_version") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serialization_version") implementation("org.springframework.boot:spring-boot-starter-actuator") @@ -201,16 +201,16 @@ dependencies { implementation("org.springframework.security:spring-security-oauth2-jose") implementation("org.springframework.boot:spring-boot-starter-data-mongodb") implementation("org.springframework.boot:spring-boot-starter-data-mongodb-reactive") - implementation("org.jetbrains.exposed:exposed-spring-boot-starter:0.44.0") + implementation("org.jetbrains.exposed:exposed-spring-boot-starter:$exposed_version") implementation("io.trbl:blurhash:1.0.0") - implementation("software.amazon.awssdk:s3:2.20.157") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:1.7.3") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.7.3") + implementation("software.amazon.awssdk:s3:2.23.17") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$coroutines_version") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:$coroutines_version") implementation("dev.usbharu:http-signature:1.0.0") - implementation("org.postgresql:postgresql:42.6.0") - implementation("com.twelvemonkeys.imageio:imageio-webp:3.10.0") + implementation("org.postgresql:postgresql:42.7.1") + implementation("com.twelvemonkeys.imageio:imageio-webp:3.10.1") implementation("org.apache.tika:tika-core:2.9.1") implementation("org.apache.tika:tika-parsers:2.9.1") implementation("net.coobird:thumbnailator:0.4.20") @@ -239,28 +239,28 @@ dependencies { implementation("io.ktor:ktor-client-logging-jvm:$ktor_version") testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4") + testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version") implementation("io.ktor:ktor-client-core:$ktor_version") implementation("io.ktor:ktor-client-cio:$ktor_version") implementation("io.ktor:ktor-client-content-negotiation:$ktor_version") testImplementation("io.ktor:ktor-client-mock:$ktor_version") - testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0") + testImplementation("org.mockito.kotlin:mockito-kotlin:5.2.1") testImplementation("org.mockito:mockito-inline:5.2.0") - testImplementation("nl.jqno.equalsverifier:equalsverifier:3.15.3") + testImplementation("nl.jqno.equalsverifier:equalsverifier:3.15.6") testImplementation("com.jparams:to-string-verifier:1.4.8") implementation("org.drewcarlson:kjob-core:0.6.0") implementation("org.drewcarlson:kjob-mongo:0.6.0") - detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.1") + detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.5") intTestImplementation("org.springframework.boot:spring-boot-starter-test") intTestImplementation("org.springframework.security:spring-security-test") intTestImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version") - intTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4") - intTestImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0") + intTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version") + intTestImplementation("org.mockito.kotlin:mockito-kotlin:5.2.1") e2eTestImplementation("org.springframework.boot:spring-boot-starter-test") e2eTestImplementation("org.springframework.security:spring-security-test") @@ -301,7 +301,7 @@ tasks.withType().configure configurations.matching { it.name == "detekt" }.all { resolutionStrategy.eachDependency { if (requested.group == "org.jetbrains.kotlin") { - useVersion("1.9.0") + useVersion("1.9.22") } } } diff --git a/gradle.properties b/gradle.properties index 5516464a..8b8439f8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,11 @@ -ktor_version=2.3.0 -kotlin_version=1.9.21 -logback_version=1.4.6 +ktor_version=2.3.8 +kotlin_version=1.9.22 +logback_version=1.4.14 +coroutines_version=1.7.3 +serialization_version=1.6.2 kotlin.code.style=official -exposed_version=0.44.0 -h2_version=2.1.214 -koin_version=3.4.3 +exposed_version=0.47.0 +h2_version=2.2.224 org.gradle.parallel=true org.gradle.configureondemand=true org.gradle.caching=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 42defcc9..509c4a29 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From d3e6d9bc7d0d771f721c2d5721a59b765c89da28 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Sun, 4 Feb 2024 16:01:57 +0900 Subject: [PATCH 3/6] =?UTF-8?q?chore:=20Kotlin=E3=81=AE=E9=9D=9E=E6=8E=A8?= =?UTF-8?q?=E5=A5=A8=E3=82=A2=E3=83=8E=E3=83=86=E3=83=BC=E3=82=B7=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E3=81=AE=E7=B6=99=E6=89=BF=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dev/usbharu/hideout/activitypub/domain/model/JsonLd.kt | 1 + .../core/infrastructure/kjobexposed/KJobJobQueueParentService.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/JsonLd.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/JsonLd.kt index 864332f4..f5e93fcb 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/JsonLd.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/JsonLd.kt @@ -62,6 +62,7 @@ class ContextDeserializer : JsonDeserializer() { class ContextSerializer : JsonSerializer>() { + @Deprecated("Deprecated in Java") override fun isEmpty(value: List?): Boolean = value.isNullOrEmpty() override fun isEmpty(provider: SerializerProvider?, value: List?): Boolean = value.isNullOrEmpty() diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/KJobJobQueueParentService.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/KJobJobQueueParentService.kt index f61949e2..aeb040d1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/KJobJobQueueParentService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/KJobJobQueueParentService.kt @@ -26,6 +26,7 @@ class KJobJobQueueParentService : JobQueueParentService { override fun init(jobDefines: List) = Unit + @Deprecated("use type safe → scheduleTypeSafe") override suspend fun schedule(job: J, block: ScheduleContext.(J) -> Unit) { logger.debug("schedule job={}", job.name) kjob.schedule(job, block) From 6d05ad9cb0193aa85f49680f1db9770dbb775406 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Sun, 4 Feb 2024 16:07:29 +0900 Subject: [PATCH 4/6] =?UTF-8?q?chore:=20Exposed=E3=81=AEAPI=E3=82=92?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/e2eTest/kotlin/AssertionUtil.kt | 3 +- src/intTest/kotlin/mastodon/apps/AppTest.kt | 6 +-- .../kotlin/mastodon/status/StatusTest.kt | 21 +++++----- .../ExposedAnnounceQueryService.kt | 8 ++-- .../exposedquery/NoteQueryServiceImpl.kt | 18 ++++----- .../ExposedNotificationRepository.kt | 7 ++-- .../RelationshipRepositoryImpl.kt | 21 +++++----- .../exposedrepository/ActorRepositoryImpl.kt | 23 ++++++----- .../CustomEmojiRepositoryImpl.kt | 35 ++++++++-------- .../DeletedActorRepositoryImpl.kt | 27 +++++++------ .../ExposedTimelineRepository.kt | 6 +-- .../InstanceRepositoryImpl.kt | 6 +-- .../exposedrepository/MediaRepositoryImpl.kt | 10 ++--- .../exposedrepository/MetaRepositoryImpl.kt | 4 +- .../exposedrepository/PostRepositoryImpl.kt | 12 +++--- .../ReactionRepositoryImpl.kt | 40 +++++++++---------- .../UserDetailRepositoryImpl.kt | 9 +++-- ...xposedOAuth2AuthorizationConsentService.kt | 4 +- .../ExposedOAuth2AuthorizationService.kt | 22 +++++----- .../oauth2/RegisteredClientRepositoryImpl.kt | 14 +++---- .../exposedquery/AccountQueryServiceImpl.kt | 6 +-- .../exposedquery/StatusQueryServiceImpl.kt | 14 +++---- .../ExposedMastodonNotificationRepository.kt | 36 ++++++++--------- .../ExposedPaginationExtensionKtTest.kt | 4 +- 24 files changed, 178 insertions(+), 178 deletions(-) diff --git a/src/e2eTest/kotlin/AssertionUtil.kt b/src/e2eTest/kotlin/AssertionUtil.kt index 6b82aa59..e0643389 100644 --- a/src/e2eTest/kotlin/AssertionUtil.kt +++ b/src/e2eTest/kotlin/AssertionUtil.kt @@ -1,6 +1,5 @@ import dev.usbharu.hideout.core.infrastructure.exposedrepository.Actors import org.jetbrains.exposed.sql.and -import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.selectAll import java.net.MalformedURLException import java.net.URL @@ -23,6 +22,6 @@ object AssertionUtil { selectAll.map { "@${it[Actors.name]}@${it[Actors.domain]}" }.forEach { println(it) } - return Actors.select { Actors.name eq username and (Actors.domain eq s) }.empty().not() + return Actors.selectAll().where { Actors.name eq username and (Actors.domain eq s) }.empty().not() } } diff --git a/src/intTest/kotlin/mastodon/apps/AppTest.kt b/src/intTest/kotlin/mastodon/apps/AppTest.kt index 026a9163..2b4bc9db 100644 --- a/src/intTest/kotlin/mastodon/apps/AppTest.kt +++ b/src/intTest/kotlin/mastodon/apps/AppTest.kt @@ -4,7 +4,7 @@ import dev.usbharu.hideout.SpringApplication import dev.usbharu.hideout.core.infrastructure.springframework.oauth2.RegisteredClient import org.assertj.core.api.Assertions.assertThat import org.flywaydb.core.Flyway -import org.jetbrains.exposed.sql.select +import org.jetbrains.exposed.sql.selectAll import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @@ -55,7 +55,7 @@ class AppTest { val app = RegisteredClient - .select { RegisteredClient.clientName eq "test-client" } + .selectAll().where { RegisteredClient.clientName eq "test-client" } .single() assertThat(app[RegisteredClient.clientName]).isEqualTo("test-client") @@ -80,7 +80,7 @@ class AppTest { .andExpect { status { isOk() } } val app = RegisteredClient - .select { RegisteredClient.clientName eq "test-client-2" } + .selectAll().where { RegisteredClient.clientName eq "test-client-2" } .single() assertThat(app[RegisteredClient.clientName]).isEqualTo("test-client-2") diff --git a/src/intTest/kotlin/mastodon/status/StatusTest.kt b/src/intTest/kotlin/mastodon/status/StatusTest.kt index 93785f56..bba2bd69 100644 --- a/src/intTest/kotlin/mastodon/status/StatusTest.kt +++ b/src/intTest/kotlin/mastodon/status/StatusTest.kt @@ -9,7 +9,7 @@ import dev.usbharu.hideout.core.infrastructure.exposedrepository.toReaction import org.assertj.core.api.Assertions.assertThat import org.flywaydb.core.Flyway import org.jetbrains.exposed.sql.and -import org.jetbrains.exposed.sql.select +import org.jetbrains.exposed.sql.selectAll import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @@ -61,7 +61,7 @@ class StatusTest { contentType = MediaType.APPLICATION_JSON content = """{"status":"hello"}""" with( - SecurityMockMvcRequestPostProcessors.jwt() + jwt() .jwt { it.claim("uid", "1") }.authorities(SimpleGrantedAuthority("SCOPE_write")) ) } @@ -76,7 +76,7 @@ class StatusTest { contentType = MediaType.APPLICATION_JSON content = """{"status":"hello"}""" with( - SecurityMockMvcRequestPostProcessors.jwt() + jwt() .jwt { it.claim("uid", "1") }.authorities(SimpleGrantedAuthority("SCOPE_write:statuses")) ) } @@ -91,7 +91,7 @@ class StatusTest { contentType = MediaType.APPLICATION_JSON content = """{"status":"hello"}""" with( - SecurityMockMvcRequestPostProcessors.jwt() + jwt() .jwt { it.claim("uid", "1") }.authorities(SimpleGrantedAuthority("SCOPE_read")) ) } @@ -128,7 +128,7 @@ class StatusTest { contentType = MediaType.APPLICATION_FORM_URLENCODED param("status", "hello") with( - SecurityMockMvcRequestPostProcessors.jwt() + jwt() .jwt { it.claim("uid", "1") }.authorities(SimpleGrantedAuthority("SCOPE_write:statuses")) ) } @@ -147,7 +147,7 @@ class StatusTest { "in_reply_to_id": "1" }""" with( - SecurityMockMvcRequestPostProcessors.jwt() + jwt() .jwt { it.claim("uid", "1") }.authorities(SimpleGrantedAuthority("SCOPE_write")) ) } @@ -167,7 +167,8 @@ class StatusTest { .asyncDispatch() .andExpect { status { isOk() } } - val reaction = Reactions.select { Reactions.postId eq 1 and (Reactions.actorId eq 1) }.single().toReaction() + val reaction = + Reactions.selectAll().where { Reactions.postId eq 1 and (Reactions.actorId eq 1) }.single().toReaction() assertThat(reaction.emoji).isEqualTo(UnicodeEmoji("😭")) assertThat(reaction.postId).isEqualTo(1) assertThat(reaction.actorId).isEqualTo(1) @@ -183,7 +184,8 @@ class StatusTest { .asyncDispatch() .andExpect { status { isOk() } } - val reaction = Reactions.select { Reactions.postId eq 1 and (Reactions.actorId eq 1) }.single().toReaction() + val reaction = + Reactions.selectAll().where { Reactions.postId eq 1 and (Reactions.actorId eq 1) }.single().toReaction() assertThat(reaction.emoji).isEqualTo(UnicodeEmoji("❤")) assertThat(reaction.postId).isEqualTo(1) assertThat(reaction.actorId).isEqualTo(1) @@ -200,7 +202,8 @@ class StatusTest { .andExpect { status { isOk() } } val reaction = - Reactions.leftJoin(CustomEmojis).select { Reactions.postId eq 1 and (Reactions.actorId eq 1) }.single() + Reactions.leftJoin(CustomEmojis).selectAll().where { Reactions.postId eq 1 and (Reactions.actorId eq 1) } + .single() .toReaction() assertThat(reaction.emoji).isEqualTo( CustomEmoji( diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/ExposedAnnounceQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/ExposedAnnounceQueryService.kt index c89a6ce1..5581b31c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/ExposedAnnounceQueryService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/ExposedAnnounceQueryService.kt @@ -10,7 +10,7 @@ import dev.usbharu.hideout.core.domain.model.post.Visibility import dev.usbharu.hideout.core.infrastructure.exposedrepository.Actors import dev.usbharu.hideout.core.infrastructure.exposedrepository.Posts import org.jetbrains.exposed.sql.ResultRow -import org.jetbrains.exposed.sql.select +import org.jetbrains.exposed.sql.selectAll import org.springframework.stereotype.Repository import java.time.Instant @@ -22,7 +22,7 @@ class ExposedAnnounceQueryService( override suspend fun findById(id: Long): Pair? { return Posts .leftJoin(Actors) - .select { Posts.id eq id } + .selectAll().where { Posts.id eq id } .singleOrNull() ?.let { (it.toAnnounce() ?: return null) to (postResultRowMapper.map(it)) } } @@ -30,7 +30,7 @@ class ExposedAnnounceQueryService( override suspend fun findByApId(apId: String): Pair? { return Posts .leftJoin(Actors) - .select { Posts.apId eq apId } + .selectAll().where { Posts.apId eq apId } .singleOrNull() ?.let { (it.toAnnounce() ?: return null) to (postResultRowMapper.map(it)) } } @@ -40,7 +40,7 @@ class ExposedAnnounceQueryService( val repost = postRepository.findById(repostId)?.url ?: return null val (to, cc) = visibility( - Visibility.values().first { visibility -> visibility.ordinal == this[Posts.visibility] }, + Visibility.entries.first { visibility -> visibility.ordinal == this[Posts.visibility] }, this[Actors.followers] ) diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/NoteQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/NoteQueryServiceImpl.kt index ffe2ee83..be0b32d8 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/NoteQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/NoteQueryServiceImpl.kt @@ -11,7 +11,7 @@ import dev.usbharu.hideout.core.domain.model.post.Visibility import dev.usbharu.hideout.core.infrastructure.exposedrepository.* import org.jetbrains.exposed.sql.Query import org.jetbrains.exposed.sql.ResultRow -import org.jetbrains.exposed.sql.select +import org.jetbrains.exposed.sql.selectAll import org.slf4j.LoggerFactory import org.springframework.stereotype.Repository import java.time.Instant @@ -24,12 +24,12 @@ class NoteQueryServiceImpl(private val postRepository: PostRepository, private v .leftJoin(Actors) .leftJoin(PostsMedia) .leftJoin(Media) - .select { Posts.id eq id } + .selectAll().where { Posts.id eq id } .let { (it.toNote() ?: return null) to ( - postQueryMapper.map(it) - .singleOrNull() ?: return null - ) + postQueryMapper.map(it) + .singleOrNull() ?: return null + ) } } @@ -38,12 +38,12 @@ class NoteQueryServiceImpl(private val postRepository: PostRepository, private v .leftJoin(Actors) .leftJoin(PostsMedia) .leftJoin(Media) - .select { Posts.apId eq apId } + .selectAll().where { Posts.apId eq apId } .let { (it.toNote() ?: return null) to ( - postQueryMapper.map(it) - .singleOrNull() ?: return null - ) + postQueryMapper.map(it) + .singleOrNull() ?: return null + ) } } diff --git a/src/main/kotlin/dev/usbharu/hideout/core/domain/model/notification/ExposedNotificationRepository.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/notification/ExposedNotificationRepository.kt index 03e28d0a..b050dab1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/domain/model/notification/ExposedNotificationRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/notification/ExposedNotificationRepository.kt @@ -21,9 +21,8 @@ class ExposedNotificationRepository(private val idGenerateService: IdGenerateSer override suspend fun generateId(): Long = idGenerateService.generateId() override suspend fun save(notification: Notification): Notification = query { - val singleOrNull = Notifications.select { - Notifications.id eq notification.id - }.forUpdate().singleOrNull() + val singleOrNull = + Notifications.selectAll().where { Notifications.id eq notification.id }.forUpdate().singleOrNull() if (singleOrNull == null) { Notifications.insert { it[id] = notification.id @@ -50,7 +49,7 @@ class ExposedNotificationRepository(private val idGenerateService: IdGenerateSer } override suspend fun findById(id: Long): Notification? = query { - Notifications.select { Notifications.id eq id }.singleOrNull()?.toNotifications() + Notifications.selectAll().where { Notifications.id eq id }.singleOrNull()?.toNotifications() } override suspend fun deleteById(id: Long) { diff --git a/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepositoryImpl.kt index fbda7c9a..818abb82 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepositoryImpl.kt @@ -18,7 +18,7 @@ class RelationshipRepositoryImpl : RelationshipRepository, AbstractRepository() get() = Companion.logger override suspend fun save(relationship: Relationship): Relationship = query { - val singleOrNull = Relationships.select { + val singleOrNull = Relationships.selectAll().where { (Relationships.actorId eq relationship.actorId).and( Relationships.targetActorId eq relationship.targetActorId ) @@ -52,16 +52,16 @@ class RelationshipRepositoryImpl : RelationshipRepository, AbstractRepository() override suspend fun delete(relationship: Relationship): Unit = query { Relationships.deleteWhere { - (Relationships.actorId eq relationship.actorId).and( - Relationships.targetActorId eq relationship.targetActorId + (actorId eq relationship.actorId).and( + targetActorId eq relationship.targetActorId ) } } override suspend fun findByUserIdAndTargetUserId(actorId: Long, targetActorId: Long): Relationship? = query { - return@query Relationships.select { - (Relationships.actorId eq actorId).and(Relationships.targetActorId eq targetActorId) - }.singleOrNull()?.toRelationships() + return@query Relationships.selectAll() + .where { (Relationships.actorId eq actorId).and(Relationships.targetActorId eq targetActorId) } + .singleOrNull()?.toRelationships() } override suspend fun deleteByActorIdOrTargetActorId(actorId: Long, targetActorId: Long): Unit = query { @@ -72,7 +72,7 @@ class RelationshipRepositoryImpl : RelationshipRepository, AbstractRepository() override suspend fun findByTargetIdAndFollowing(targetId: Long, following: Boolean): List = query { return@query Relationships - .select { Relationships.targetActorId eq targetId and (Relationships.following eq following) } + .selectAll().where { Relationships.targetActorId eq targetId and (Relationships.following eq following) } .map { it.toRelationships() } } @@ -82,7 +82,7 @@ class RelationshipRepositoryImpl : RelationshipRepository, AbstractRepository() ignoreFollowRequest: Boolean, page: Page.PageByMaxId ): PaginationList = query { - val query = Relationships.select { + val query = Relationships.selectAll().where { Relationships.targetActorId.eq(targetId).and(Relationships.followRequest.eq(followRequest)) .and(Relationships.ignoreFollowRequestFromTarget.eq(ignoreFollowRequest)) } @@ -101,9 +101,8 @@ class RelationshipRepositoryImpl : RelationshipRepository, AbstractRepository() muting: Boolean, page: Page.PageByMaxId ): PaginationList = query { - val query = Relationships.select { - Relationships.actorId.eq(actorId).and(Relationships.muting.eq(muting)) - } + val query = + Relationships.selectAll().where { Relationships.actorId.eq(actorId).and(Relationships.muting.eq(muting)) } val resultRowList = query.withPagination(page, Relationships.id) diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ActorRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ActorRepositoryImpl.kt index e0d7eca2..b4dcf73c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ActorRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ActorRepositoryImpl.kt @@ -22,7 +22,7 @@ class ActorRepositoryImpl( get() = Companion.logger override suspend fun save(actor: Actor): Actor = query { - val singleOrNull = Actors.select { Actors.id eq actor.id }.forUpdate().empty() + val singleOrNull = Actors.selectAll().where { Actors.id eq actor.id }.forUpdate().empty() if (singleOrNull) { Actors.insert { it[id] = actor.id @@ -75,11 +75,12 @@ class ActorRepositoryImpl( } override suspend fun findById(id: Long): Actor? = query { - return@query Actors.select { Actors.id eq id }.singleOrNull()?.let(actorResultRowMapper::map) + return@query Actors.selectAll().where { Actors.id eq id }.singleOrNull()?.let(actorResultRowMapper::map) } override suspend fun findByIdWithLock(id: Long): Actor? = query { - return@query Actors.select { Actors.id eq id }.forUpdate().singleOrNull()?.let(actorResultRowMapper::map) + return@query Actors.selectAll().where { Actors.id eq id }.forUpdate().singleOrNull() + ?.let(actorResultRowMapper::map) } override suspend fun findAll(limit: Int, offset: Long): List = query { @@ -87,33 +88,35 @@ class ActorRepositoryImpl( } override suspend fun findByName(name: String): List = query { - return@query Actors.select { Actors.name eq name }.let(actorQueryMapper::map) + return@query Actors.selectAll().where { Actors.name eq name }.let(actorQueryMapper::map) } override suspend fun findByNameAndDomain(name: String, domain: String): Actor? = query { - return@query Actors.select { Actors.name eq name and (Actors.domain eq domain) }.singleOrNull() + return@query Actors.selectAll().where { Actors.name eq name and (Actors.domain eq domain) }.singleOrNull() ?.let(actorResultRowMapper::map) } override suspend fun findByNameAndDomainWithLock(name: String, domain: String): Actor? = query { - return@query Actors.select { Actors.name eq name and (Actors.domain eq domain) }.forUpdate().singleOrNull() + return@query Actors.selectAll().where { Actors.name eq name and (Actors.domain eq domain) }.forUpdate() + .singleOrNull() ?.let(actorResultRowMapper::map) } override suspend fun findByUrl(url: String): Actor? = query { - return@query Actors.select { Actors.url eq url }.singleOrNull()?.let(actorResultRowMapper::map) + return@query Actors.selectAll().where { Actors.url eq url }.singleOrNull()?.let(actorResultRowMapper::map) } override suspend fun findByUrlWithLock(url: String): Actor? = query { - return@query Actors.select { Actors.url eq url }.forUpdate().singleOrNull()?.let(actorResultRowMapper::map) + return@query Actors.selectAll().where { Actors.url eq url }.forUpdate().singleOrNull() + ?.let(actorResultRowMapper::map) } override suspend fun findByIds(ids: List): List = query { - return@query Actors.select { Actors.id inList ids }.let(actorQueryMapper::map) + return@query Actors.selectAll().where { Actors.id inList ids }.let(actorQueryMapper::map) } override suspend fun findByKeyId(keyId: String): Actor? = query { - return@query Actors.select { Actors.keyId eq keyId }.singleOrNull()?.let(actorResultRowMapper::map) + return@query Actors.selectAll().where { Actors.keyId eq keyId }.singleOrNull()?.let(actorResultRowMapper::map) } override suspend fun delete(id: Long): Unit = query { diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/CustomEmojiRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/CustomEmojiRepositoryImpl.kt index 3310c138..1c81b846 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/CustomEmojiRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/CustomEmojiRepositoryImpl.kt @@ -20,41 +20,42 @@ class CustomEmojiRepositoryImpl(private val idGenerateService: IdGenerateService override suspend fun generateId(): Long = idGenerateService.generateId() override suspend fun save(customEmoji: CustomEmoji): CustomEmoji = query { - val singleOrNull = CustomEmojis.select { CustomEmojis.id eq customEmoji.id }.forUpdate().singleOrNull() + val singleOrNull = + CustomEmojis.selectAll().where { CustomEmojis.id eq customEmoji.id }.forUpdate().singleOrNull() if (singleOrNull == null) { CustomEmojis.insert { - it[CustomEmojis.id] = customEmoji.id - it[CustomEmojis.name] = customEmoji.name - it[CustomEmojis.domain] = customEmoji.domain - it[CustomEmojis.instanceId] = customEmoji.instanceId - it[CustomEmojis.url] = customEmoji.url - it[CustomEmojis.category] = customEmoji.category - it[CustomEmojis.createdAt] = customEmoji.createdAt + it[id] = customEmoji.id + it[name] = customEmoji.name + it[domain] = customEmoji.domain + it[instanceId] = customEmoji.instanceId + it[url] = customEmoji.url + it[category] = customEmoji.category + it[createdAt] = customEmoji.createdAt } } else { CustomEmojis.update({ CustomEmojis.id eq customEmoji.id }) { - it[CustomEmojis.name] = customEmoji.name - it[CustomEmojis.domain] = customEmoji.domain - it[CustomEmojis.instanceId] = customEmoji.instanceId - it[CustomEmojis.url] = customEmoji.url - it[CustomEmojis.category] = customEmoji.category - it[CustomEmojis.createdAt] = customEmoji.createdAt + it[name] = customEmoji.name + it[domain] = customEmoji.domain + it[instanceId] = customEmoji.instanceId + it[url] = customEmoji.url + it[category] = customEmoji.category + it[createdAt] = customEmoji.createdAt } } return@query customEmoji } override suspend fun findById(id: Long): CustomEmoji? = query { - return@query CustomEmojis.select { CustomEmojis.id eq id }.singleOrNull()?.toCustomEmoji() + return@query CustomEmojis.selectAll().where { CustomEmojis.id eq id }.singleOrNull()?.toCustomEmoji() } override suspend fun delete(customEmoji: CustomEmoji): Unit = query { - CustomEmojis.deleteWhere { CustomEmojis.id eq customEmoji.id } + CustomEmojis.deleteWhere { id eq customEmoji.id } } override suspend fun findByNameAndDomain(name: String, domain: String): CustomEmoji? = query { return@query CustomEmojis - .select { CustomEmojis.name eq name and (CustomEmojis.domain eq domain) } + .selectAll().where { CustomEmojis.name eq name and (CustomEmojis.domain eq domain) } .singleOrNull() ?.toCustomEmoji() } diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/DeletedActorRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/DeletedActorRepositoryImpl.kt index 36b22b80..43cbaaa1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/DeletedActorRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/DeletedActorRepositoryImpl.kt @@ -15,41 +15,42 @@ class DeletedActorRepositoryImpl : DeletedActorRepository, AbstractRepository() get() = Companion.logger override suspend fun save(deletedActor: DeletedActor): DeletedActor = query { - val singleOrNull = DeletedActors.select { DeletedActors.id eq deletedActor.id }.forUpdate().singleOrNull() + val singleOrNull = + DeletedActors.selectAll().where { DeletedActors.id eq deletedActor.id }.forUpdate().singleOrNull() if (singleOrNull == null) { DeletedActors.insert { - it[DeletedActors.id] = deletedActor.id - it[DeletedActors.name] = deletedActor.name - it[DeletedActors.domain] = deletedActor.domain - it[DeletedActors.publicKey] = deletedActor.publicKey - it[DeletedActors.deletedAt] = deletedActor.deletedAt + it[id] = deletedActor.id + it[name] = deletedActor.name + it[domain] = deletedActor.domain + it[publicKey] = deletedActor.publicKey + it[deletedAt] = deletedActor.deletedAt } } else { DeletedActors.update({ DeletedActors.id eq deletedActor.id }) { - it[DeletedActors.name] = deletedActor.name - it[DeletedActors.domain] = deletedActor.domain - it[DeletedActors.publicKey] = deletedActor.publicKey - it[DeletedActors.deletedAt] = deletedActor.deletedAt + it[name] = deletedActor.name + it[domain] = deletedActor.domain + it[publicKey] = deletedActor.publicKey + it[deletedAt] = deletedActor.deletedAt } } return@query deletedActor } override suspend fun delete(deletedActor: DeletedActor): Unit = query { - DeletedActors.deleteWhere { DeletedActors.id eq deletedActor.id } + DeletedActors.deleteWhere { id eq deletedActor.id } } override suspend fun findById(id: Long): DeletedActor? = query { return@query DeletedActors - .select { DeletedActors.id eq id } + .selectAll().where { DeletedActors.id eq id } .singleOrNull() ?.toDeletedActor() } override suspend fun findByNameAndDomain(name: String, domain: String): DeletedActor? = query { return@query DeletedActors - .select { DeletedActors.name eq name and (DeletedActors.domain eq domain) } + .selectAll().where { DeletedActors.name eq name and (DeletedActors.domain eq domain) } .singleOrNull() ?.toDeletedActor() } diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedTimelineRepository.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedTimelineRepository.kt index 7a630374..0cb9154f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedTimelineRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedTimelineRepository.kt @@ -22,7 +22,7 @@ class ExposedTimelineRepository(private val idGenerateService: IdGenerateService override suspend fun generateId(): Long = idGenerateService.generateId() override suspend fun save(timeline: Timeline): Timeline = query { - if (Timelines.select { Timelines.id eq timeline.id }.forUpdate().singleOrNull() == null) { + if (Timelines.selectAll().where { Timelines.id eq timeline.id }.forUpdate().singleOrNull() == null) { Timelines.insert { it[id] = timeline.id it[userId] = timeline.userId @@ -80,11 +80,11 @@ class ExposedTimelineRepository(private val idGenerateService: IdGenerateService } override suspend fun findByUserId(id: Long): List = query { - return@query Timelines.select { Timelines.userId eq id }.map { it.toTimeline() } + return@query Timelines.selectAll().where { Timelines.userId eq id }.map { it.toTimeline() } } override suspend fun findByUserIdAndTimelineId(userId: Long, timelineId: Long): List = query { - return@query Timelines.select { Timelines.userId eq userId and (Timelines.timelineId eq timelineId) } + return@query Timelines.selectAll().where { Timelines.userId eq userId and (Timelines.timelineId eq timelineId) } .map { it.toTimeline() } } diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/InstanceRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/InstanceRepositoryImpl.kt index 485cf6de..c6d8a71d 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/InstanceRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/InstanceRepositoryImpl.kt @@ -19,7 +19,7 @@ class InstanceRepositoryImpl(private val idGenerateService: IdGenerateService) : override suspend fun generateId(): Long = idGenerateService.generateId() override suspend fun save(instance: InstanceEntity): InstanceEntity = query { - if (Instance.select { Instance.id.eq(instance.id) }.forUpdate().empty()) { + if (Instance.selectAll().where { Instance.id.eq(instance.id) }.forUpdate().empty()) { Instance.insert { it[id] = instance.id it[name] = instance.name @@ -53,7 +53,7 @@ class InstanceRepositoryImpl(private val idGenerateService: IdGenerateService) : } override suspend fun findById(id: Long): InstanceEntity? = query { - return@query Instance.select { Instance.id eq id } + return@query Instance.selectAll().where { Instance.id eq id } .singleOrNull()?.toInstance() } @@ -62,7 +62,7 @@ class InstanceRepositoryImpl(private val idGenerateService: IdGenerateService) : } override suspend fun findByUrl(url: String): dev.usbharu.hideout.core.domain.model.instance.Instance? = query { - return@query Instance.select { Instance.url eq url }.singleOrNull()?.toInstance() + return@query Instance.selectAll().where { Instance.url eq url }.singleOrNull()?.toInstance() } companion object { diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/MediaRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/MediaRepositoryImpl.kt index c838031c..418b1bc1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/MediaRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/MediaRepositoryImpl.kt @@ -20,9 +20,7 @@ class MediaRepositoryImpl(private val idGenerateService: IdGenerateService) : Me override suspend fun generateId(): Long = idGenerateService.generateId() override suspend fun save(media: EntityMedia): EntityMedia = query { - if (Media.select { - Media.id eq media.id - }.forUpdate().singleOrNull() != null + if (Media.selectAll().where { Media.id eq media.id }.forUpdate().singleOrNull() != null ) { Media.update({ Media.id eq media.id }) { it[name] = media.name @@ -52,9 +50,7 @@ class MediaRepositoryImpl(private val idGenerateService: IdGenerateService) : Me override suspend fun findById(id: Long): EntityMedia? = query { return@query Media - .select { - Media.id eq id - } + .selectAll().where { Media.id eq id } .singleOrNull() ?.toMedia() } @@ -67,7 +63,7 @@ class MediaRepositoryImpl(private val idGenerateService: IdGenerateService) : Me override suspend fun findByRemoteUrl(remoteUrl: String): dev.usbharu.hideout.core.domain.model.media.Media? = query { - return@query Media.select { Media.remoteUrl eq remoteUrl }.singleOrNull()?.toMedia() + return@query Media.selectAll().where { Media.remoteUrl eq remoteUrl }.singleOrNull()?.toMedia() } companion object { diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/MetaRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/MetaRepositoryImpl.kt index 493ba37c..eebf58fc 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/MetaRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/MetaRepositoryImpl.kt @@ -10,7 +10,7 @@ import java.util.* class MetaRepositoryImpl : MetaRepository { override suspend fun save(meta: dev.usbharu.hideout.core.domain.model.meta.Meta) { - if (Meta.select { Meta.id eq 1 }.empty()) { + if (Meta.selectAll().where { Meta.id eq 1 }.empty()) { Meta.insert { it[id] = 1 it[version] = meta.version @@ -29,7 +29,7 @@ class MetaRepositoryImpl : MetaRepository { } override suspend fun get(): dev.usbharu.hideout.core.domain.model.meta.Meta? { - return Meta.select { Meta.id eq 1 }.singleOrNull()?.let { + return Meta.selectAll().where { Meta.id eq 1 }.singleOrNull()?.let { dev.usbharu.hideout.core.domain.model.meta.Meta( it[Meta.version], Jwt(UUID.fromString(it[Meta.kid]), it[Meta.jwtPrivateKey], it[Meta.jwtPublicKey]) diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/PostRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/PostRepositoryImpl.kt index b3816c23..04f55e73 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/PostRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/PostRepositoryImpl.kt @@ -21,7 +21,7 @@ class PostRepositoryImpl( override suspend fun generateId(): Long = idGenerateService.generateId() override suspend fun save(post: Post): Post = query { - val singleOrNull = Posts.select { Posts.id eq post.id }.forUpdate().singleOrNull() + val singleOrNull = Posts.selectAll().where { Posts.id eq post.id }.forUpdate().singleOrNull() if (singleOrNull == null) { Posts.insert { it[id] = post.id @@ -83,7 +83,7 @@ class PostRepositoryImpl( return@query Posts .leftJoin(PostsMedia) .leftJoin(PostsEmojis) - .select { Posts.id eq id } + .selectAll().where { Posts.id eq id } .let(postQueryMapper::map) .singleOrNull() } @@ -92,7 +92,7 @@ class PostRepositoryImpl( return@query Posts .leftJoin(PostsMedia) .leftJoin(PostsEmojis) - .select { Posts.url eq url } + .selectAll().where { Posts.url eq url } .let(postQueryMapper::map) .singleOrNull() } @@ -101,20 +101,20 @@ class PostRepositoryImpl( return@query Posts .leftJoin(PostsMedia) .leftJoin(PostsEmojis) - .select { Posts.apId eq apId } + .selectAll().where { Posts.apId eq apId } .let(postQueryMapper::map) .singleOrNull() } override suspend fun existByApIdWithLock(apId: String): Boolean = query { - return@query Posts.select { Posts.apId eq apId }.forUpdate().empty().not() + return@query Posts.selectAll().where { Posts.apId eq apId }.forUpdate().empty().not() } override suspend fun findByActorId(actorId: Long): List = query { return@query Posts .leftJoin(PostsMedia) .leftJoin(PostsEmojis) - .select { Posts.actorId eq actorId }.let(postQueryMapper::map) + .selectAll().where { Posts.actorId eq actorId }.let(postQueryMapper::map) } override suspend fun delete(id: Long): Unit = query { diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ReactionRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ReactionRepositoryImpl.kt index ee6cbf3b..04a97a7f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ReactionRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ReactionRepositoryImpl.kt @@ -23,7 +23,7 @@ class ReactionRepositoryImpl( override suspend fun generateId(): Long = idGenerateService.generateId() override suspend fun save(reaction: Reaction): Reaction = query { - if (Reactions.select { Reactions.id eq reaction.id }.forUpdate().empty()) { + if (Reactions.selectAll().where { Reactions.id eq reaction.id }.forUpdate().empty()) { Reactions.insert { it[id] = reaction.id if (reaction.emoji is CustomEmoji) { @@ -90,30 +90,32 @@ class ReactionRepositoryImpl( Reactions.deleteWhere { Reactions.postId.eq(postId) .and(Reactions.actorId.eq(actorId)) - .and(Reactions.customEmojiId.eq(emoji.id)) + .and(customEmojiId.eq(emoji.id)) } } else { Reactions.deleteWhere { Reactions.postId.eq(postId) .and(Reactions.actorId.eq(actorId)) - .and(Reactions.unicodeEmoji.eq(emoji.name)) + .and(unicodeEmoji.eq(emoji.name)) } } } override suspend fun findById(id: Long): Reaction? = query { - return@query Reactions.leftJoin(CustomEmojis).select { Reactions.id eq id }.singleOrNull()?.toReaction() + return@query Reactions.leftJoin(CustomEmojis).selectAll().where { Reactions.id eq id }.singleOrNull() + ?.toReaction() } override suspend fun findByPostId(postId: Long): List = query { - return@query Reactions.leftJoin(CustomEmojis).select { Reactions.postId eq postId }.map { it.toReaction() } + return@query Reactions.leftJoin(CustomEmojis).selectAll().where { Reactions.postId eq postId } + .map { it.toReaction() } } override suspend fun findByPostIdAndActorIdAndEmojiId(postId: Long, actorId: Long, emojiId: Long): Reaction? = query { - return@query Reactions.leftJoin(CustomEmojis).select { + return@query Reactions.leftJoin(CustomEmojis).selectAll().where { Reactions.postId eq postId and (Reactions.actorId eq actorId).and( - Reactions.customEmojiId.eq( + Reactions.customEmojiId.eq( emojiId ) ) @@ -122,11 +124,11 @@ class ReactionRepositoryImpl( override suspend fun existByPostIdAndActorIdAndEmojiId(postId: Long, actorId: Long, emojiId: Long): Boolean = query { - return@query Reactions.select { + return@query Reactions.selectAll().where { Reactions.postId - .eq(postId) - .and(Reactions.actorId.eq(actorId)) - .and(Reactions.customEmojiId.eq(emojiId)) + .eq(postId) + .and(Reactions.actorId.eq(actorId)) + .and(Reactions.customEmojiId.eq(emojiId)) }.empty().not() } @@ -135,16 +137,16 @@ class ReactionRepositoryImpl( actorId: Long, unicodeEmoji: String ): Boolean = query { - return@query Reactions.select { + return@query Reactions.selectAll().where { Reactions.postId - .eq(postId) - .and(Reactions.actorId.eq(actorId)) - .and(Reactions.unicodeEmoji.eq(unicodeEmoji)) + .eq(postId) + .and(Reactions.actorId.eq(actorId)) + .and(Reactions.unicodeEmoji.eq(unicodeEmoji)) }.empty().not() } override suspend fun existByPostIdAndActorIdAndEmoji(postId: Long, actorId: Long, emoji: Emoji): Boolean = query { - val query = Reactions.select { + val query = Reactions.selectAll().where { Reactions.postId .eq(postId) .and(Reactions.actorId.eq(actorId)) @@ -161,14 +163,12 @@ class ReactionRepositoryImpl( } override suspend fun existByPostIdAndActor(postId: Long, actorId: Long): Boolean = query { - Reactions.select { - Reactions.postId.eq(postId).and(Reactions.actorId.eq(actorId)) - }.empty().not() + Reactions.selectAll().where { Reactions.postId.eq(postId).and(Reactions.actorId.eq(actorId)) }.empty().not() } override suspend fun findByPostIdAndActorId(postId: Long, actorId: Long): List = query { return@query Reactions.leftJoin(CustomEmojis) - .select { Reactions.postId eq postId and (Reactions.actorId eq actorId) } + .selectAll().where { Reactions.postId eq postId and (Reactions.actorId eq actorId) } .map { it.toReaction() } } diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/UserDetailRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/UserDetailRepositoryImpl.kt index 9b58365d..4b474080 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/UserDetailRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/UserDetailRepositoryImpl.kt @@ -6,7 +6,7 @@ import org.jetbrains.exposed.dao.id.LongIdTable import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq import org.jetbrains.exposed.sql.deleteWhere import org.jetbrains.exposed.sql.insert -import org.jetbrains.exposed.sql.select +import org.jetbrains.exposed.sql.selectAll import org.jetbrains.exposed.sql.update import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -18,7 +18,8 @@ class UserDetailRepositoryImpl : UserDetailRepository, AbstractRepository() { get() = Companion.logger override suspend fun save(userDetail: UserDetail): UserDetail = query { - val singleOrNull = UserDetails.select { UserDetails.actorId eq userDetail.actorId }.forUpdate().singleOrNull() + val singleOrNull = + UserDetails.selectAll().where { UserDetails.actorId eq userDetail.actorId }.forUpdate().singleOrNull() if (singleOrNull == null) { UserDetails.insert { it[actorId] = userDetail.actorId @@ -35,12 +36,12 @@ class UserDetailRepositoryImpl : UserDetailRepository, AbstractRepository() { } override suspend fun delete(userDetail: UserDetail): Unit = query { - UserDetails.deleteWhere { UserDetails.actorId eq userDetail.actorId } + UserDetails.deleteWhere { actorId eq userDetail.actorId } } override suspend fun findByActorId(actorId: Long): UserDetail? = query { return@query UserDetails - .select { UserDetails.actorId eq actorId } + .selectAll().where { UserDetails.actorId eq actorId } .singleOrNull() ?.let { UserDetail( diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/ExposedOAuth2AuthorizationConsentService.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/ExposedOAuth2AuthorizationConsentService.kt index 82438544..da495a03 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/ExposedOAuth2AuthorizationConsentService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/ExposedOAuth2AuthorizationConsentService.kt @@ -21,7 +21,7 @@ class ExposedOAuth2AuthorizationConsentService( requireNotNull(authorizationConsent) transaction.transaction { val singleOrNull = - OAuth2AuthorizationConsent.select { + OAuth2AuthorizationConsent.selectAll().where { OAuth2AuthorizationConsent.registeredClientId .eq(authorizationConsent.registeredClientId) .and(OAuth2AuthorizationConsent.principalName.eq(authorizationConsent.principalName)) @@ -50,7 +50,7 @@ class ExposedOAuth2AuthorizationConsentService( requireNotNull(registeredClientId) requireNotNull(principalName) transaction.transaction { - OAuth2AuthorizationConsent.select { + OAuth2AuthorizationConsent.selectAll().where { (OAuth2AuthorizationConsent.registeredClientId eq registeredClientId) .and(OAuth2AuthorizationConsent.principalName eq principalName) } diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/ExposedOAuth2AuthorizationService.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/ExposedOAuth2AuthorizationService.kt index 9be529c2..a39292f1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/ExposedOAuth2AuthorizationService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/ExposedOAuth2AuthorizationService.kt @@ -34,7 +34,7 @@ class ExposedOAuth2AuthorizationService( override fun save(authorization: OAuth2Authorization?): Unit = runBlocking { requireNotNull(authorization) transaction.transaction { - val singleOrNull = Authorization.select { Authorization.id eq authorization.id }.singleOrNull() + val singleOrNull = Authorization.selectAll().where { Authorization.id eq authorization.id }.singleOrNull() if (singleOrNull == null) { val authorizationCodeToken = authorization.getToken(OAuth2AuthorizationCode::class.java) val accessToken = authorization.getToken(OAuth2AccessToken::class.java) @@ -139,7 +139,7 @@ class ExposedOAuth2AuthorizationService( if (id == null) { return null } - return Authorization.select { Authorization.id eq id }.singleOrNull()?.toAuthorization() + return Authorization.selectAll().where { Authorization.id eq id }.singleOrNull()?.toAuthorization() } override fun findByToken(token: String?, tokenType: OAuth2TokenType?): OAuth2Authorization? = runBlocking { @@ -147,9 +147,7 @@ class ExposedOAuth2AuthorizationService( transaction.transaction { when (tokenType?.value) { null -> { - Authorization.select { - Authorization.authorizationCodeValue eq token - }.orWhere { + Authorization.selectAll().where { Authorization.authorizationCodeValue eq token }.orWhere { Authorization.accessTokenValue eq token }.orWhere { Authorization.oidcIdTokenValue eq token @@ -163,31 +161,31 @@ class ExposedOAuth2AuthorizationService( } OAuth2ParameterNames.STATE -> { - Authorization.select { Authorization.state eq token } + Authorization.selectAll().where { Authorization.state eq token } } OAuth2ParameterNames.CODE -> { - Authorization.select { Authorization.authorizationCodeValue eq token } + Authorization.selectAll().where { Authorization.authorizationCodeValue eq token } } OAuth2ParameterNames.ACCESS_TOKEN -> { - Authorization.select { Authorization.accessTokenValue eq token } + Authorization.selectAll().where { Authorization.accessTokenValue eq token } } OidcParameterNames.ID_TOKEN -> { - Authorization.select { Authorization.oidcIdTokenValue eq token } + Authorization.selectAll().where { Authorization.oidcIdTokenValue eq token } } OAuth2ParameterNames.REFRESH_TOKEN -> { - Authorization.select { Authorization.refreshTokenValue eq token } + Authorization.selectAll().where { Authorization.refreshTokenValue eq token } } OAuth2ParameterNames.USER_CODE -> { - Authorization.select { Authorization.userCodeValue eq token } + Authorization.selectAll().where { Authorization.userCodeValue eq token } } OAuth2ParameterNames.DEVICE_CODE -> { - Authorization.select { Authorization.deviceCodeValue eq token } + Authorization.selectAll().where { Authorization.deviceCodeValue eq token } } else -> { diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/RegisteredClientRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/RegisteredClientRepositoryImpl.kt index ed07c162..3362024b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/RegisteredClientRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/RegisteredClientRepositoryImpl.kt @@ -7,6 +7,7 @@ import dev.usbharu.hideout.core.infrastructure.springframework.oauth2.Registered import dev.usbharu.hideout.core.infrastructure.springframework.oauth2.RegisteredClient.clientSettings import dev.usbharu.hideout.core.infrastructure.springframework.oauth2.RegisteredClient.tokenSettings import org.jetbrains.exposed.sql.* +import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq import org.jetbrains.exposed.sql.javatime.CurrentTimestamp import org.jetbrains.exposed.sql.javatime.timestamp import org.slf4j.Logger @@ -30,7 +31,8 @@ class RegisteredClientRepositoryImpl : RegisteredClientRepository { override fun save(registeredClient: SpringRegisteredClient?) { requireNotNull(registeredClient) - val singleOrNull = RegisteredClient.select { RegisteredClient.id eq registeredClient.id }.singleOrNull() + val singleOrNull = + RegisteredClient.selectAll().where { RegisteredClient.id eq registeredClient.id }.singleOrNull() if (singleOrNull == null) { RegisteredClient.insert { it[id] = registeredClient.id @@ -71,9 +73,7 @@ class RegisteredClientRepositoryImpl : RegisteredClientRepository { if (id == null) { return null } - return RegisteredClient.select { - RegisteredClient.id eq id - }.singleOrNull()?.toRegisteredClient() + return RegisteredClient.selectAll().where { RegisteredClient.id eq id }.singleOrNull()?.toRegisteredClient() } @Transactional @@ -81,9 +81,9 @@ class RegisteredClientRepositoryImpl : RegisteredClientRepository { if (clientId == null) { return null } - val toRegisteredClient = RegisteredClient.select { - RegisteredClient.clientId eq clientId - }.singleOrNull()?.toRegisteredClient() + val toRegisteredClient = + RegisteredClient.selectAll().where { RegisteredClient.clientId eq clientId }.singleOrNull() + ?.toRegisteredClient() LOGGER.trace("findByClientId: {}", toRegisteredClient) return toRegisteredClient } diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/AccountQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/AccountQueryServiceImpl.kt index 4cd4ed55..9cbf8e26 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/AccountQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/AccountQueryServiceImpl.kt @@ -5,14 +5,14 @@ import dev.usbharu.hideout.core.infrastructure.exposedrepository.Actors import dev.usbharu.hideout.domain.mastodon.model.generated.Account import dev.usbharu.hideout.mastodon.query.AccountQueryService import org.jetbrains.exposed.sql.ResultRow -import org.jetbrains.exposed.sql.select +import org.jetbrains.exposed.sql.selectAll import org.springframework.stereotype.Repository import java.time.Instant @Repository class AccountQueryServiceImpl(private val applicationConfig: ApplicationConfig) : AccountQueryService { override suspend fun findById(accountId: Long): Account? { - val query = Actors.select { Actors.id eq accountId } + val query = Actors.selectAll().where { Actors.id eq accountId } return query .singleOrNull() @@ -20,7 +20,7 @@ class AccountQueryServiceImpl(private val applicationConfig: ApplicationConfig) } override suspend fun findByIds(accountIds: List): List { - val query = Actors.select { Actors.id inList accountIds } + val query = Actors.selectAll().where { Actors.id inList accountIds } return query .map { toAccount(it) } diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/StatusQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/StatusQueryServiceImpl.kt index 2b9f3676..17f2dea4 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/StatusQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/StatusQueryServiceImpl.kt @@ -13,7 +13,7 @@ import dev.usbharu.hideout.mastodon.interfaces.api.status.StatusQuery import dev.usbharu.hideout.mastodon.query.StatusQueryService import org.jetbrains.exposed.sql.ResultRow import org.jetbrains.exposed.sql.andWhere -import org.jetbrains.exposed.sql.select +import org.jetbrains.exposed.sql.selectAll import org.springframework.stereotype.Repository import java.time.Instant import dev.usbharu.hideout.domain.mastodon.model.generated.CustomEmoji as MastodonEmoji @@ -34,14 +34,14 @@ class StatusQueryServiceImpl : StatusQueryService { val postMap = Posts .leftJoin(Actors) - .select { Posts.id inList postIdSet } + .selectAll().where { Posts.id inList postIdSet } .associate { it[Posts.id] to toStatus(it) } - val mediaMap = Media.select { Media.id inList mediaIdSet } + val mediaMap = Media.selectAll().where { Media.id inList mediaIdSet } .associate { it[Media.id] to it.toMedia().toMediaAttachments() } - val emojiMap = CustomEmojis.select { CustomEmojis.id inList emojiIdSet }.associate { + val emojiMap = CustomEmojis.selectAll().where { CustomEmojis.id inList emojiIdSet }.associate { it[CustomEmojis.id] to it.toCustomEmoji().toMastodonEmoji() } return statusQueries.mapNotNull { statusQuery -> @@ -69,7 +69,7 @@ class StatusQueryServiceImpl : StatusQueryService { .leftJoin(PostsMedia) .leftJoin(Actors) .leftJoin(Media) - .select { Posts.actorId eq accountId } + .selectAll().where { Posts.actorId eq accountId } if (onlyMedia) { query.andWhere { PostsMedia.mediaId.isNotNull() } @@ -111,7 +111,7 @@ class StatusQueryServiceImpl : StatusQueryService { .leftJoin(PostsMedia) .leftJoin(Actors) .leftJoin(Media) - .select { Posts.id eq id } + .selectAll().where { Posts.id eq id } .groupBy { it[Posts.id] } .map { it.value } .map { @@ -153,7 +153,7 @@ class StatusQueryServiceImpl : StatusQueryService { .leftJoin(CustomEmojis) .leftJoin(Actors) .leftJoin(Media) - .select { Posts.id inList ids } + .selectAll().where { Posts.id inList ids } .groupBy { it[Posts.id] } .map { it.value } .map { diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedrepository/ExposedMastodonNotificationRepository.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedrepository/ExposedMastodonNotificationRepository.kt index ff67cae5..daf369cb 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedrepository/ExposedMastodonNotificationRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedrepository/ExposedMastodonNotificationRepository.kt @@ -25,26 +25,27 @@ class ExposedMastodonNotificationRepository : MastodonNotificationRepository, Ab override suspend fun save(mastodonNotification: MastodonNotification): MastodonNotification = query { val singleOrNull = - MastodonNotifications.select { MastodonNotifications.id eq mastodonNotification.id }.singleOrNull() + MastodonNotifications.selectAll().where { MastodonNotifications.id eq mastodonNotification.id } + .singleOrNull() if (singleOrNull == null) { MastodonNotifications.insert { - it[MastodonNotifications.id] = mastodonNotification.id - it[MastodonNotifications.type] = mastodonNotification.type.name - it[MastodonNotifications.createdAt] = mastodonNotification.createdAt - it[MastodonNotifications.accountId] = mastodonNotification.accountId - it[MastodonNotifications.statusId] = mastodonNotification.statusId - it[MastodonNotifications.reportId] = mastodonNotification.reportId - it[MastodonNotifications.relationshipServeranceEventId] = + it[id] = mastodonNotification.id + it[type] = mastodonNotification.type.name + it[createdAt] = mastodonNotification.createdAt + it[accountId] = mastodonNotification.accountId + it[statusId] = mastodonNotification.statusId + it[reportId] = mastodonNotification.reportId + it[relationshipServeranceEventId] = mastodonNotification.relationshipServeranceEvent } } else { MastodonNotifications.update({ MastodonNotifications.id eq mastodonNotification.id }) { - it[MastodonNotifications.type] = mastodonNotification.type.name - it[MastodonNotifications.createdAt] = mastodonNotification.createdAt - it[MastodonNotifications.accountId] = mastodonNotification.accountId - it[MastodonNotifications.statusId] = mastodonNotification.statusId - it[MastodonNotifications.reportId] = mastodonNotification.reportId - it[MastodonNotifications.relationshipServeranceEventId] = + it[type] = mastodonNotification.type.name + it[createdAt] = mastodonNotification.createdAt + it[accountId] = mastodonNotification.accountId + it[statusId] = mastodonNotification.statusId + it[reportId] = mastodonNotification.reportId + it[relationshipServeranceEventId] = mastodonNotification.relationshipServeranceEvent } } @@ -58,7 +59,8 @@ class ExposedMastodonNotificationRepository : MastodonNotificationRepository, Ab } override suspend fun findById(id: Long): MastodonNotification? = query { - MastodonNotifications.select { MastodonNotifications.id eq id }.singleOrNull()?.toMastodonNotification() + MastodonNotifications.selectAll().where { MastodonNotifications.id eq id }.singleOrNull() + ?.toMastodonNotification() } override suspend fun findByUserIdAndInTypesAndInSourceActorId( @@ -67,9 +69,7 @@ class ExposedMastodonNotificationRepository : MastodonNotificationRepository, Ab accountId: List, page: Page ): PaginationList = query { - val query = MastodonNotifications.select { - MastodonNotifications.userId eq loginUser - } + val query = MastodonNotifications.selectAll().where { MastodonNotifications.userId eq loginUser } val result = query.withPagination(page, MastodonNotifications.id) return@query PaginationList(result.map { it.toMastodonNotification() }, result.next, result.prev) diff --git a/src/test/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedPaginationExtensionKtTest.kt b/src/test/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedPaginationExtensionKtTest.kt index 2f6930d5..ecb555e0 100644 --- a/src/test/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedPaginationExtensionKtTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedPaginationExtensionKtTest.kt @@ -99,7 +99,7 @@ class ExposedPaginationExtensionKtTest { @Test fun 結果が0件の場合はprevとnextがnullになる():Unit = transaction { - val pagination = ExposePaginationTestTable.select { ExposePaginationTestTable.id.isNull() } + val pagination = ExposePaginationTestTable.selectAll().where { ExposePaginationTestTable.id.isNull() } .withPagination(Page.of(), ExposePaginationTestTable.id) assertThat(pagination).isEmpty() @@ -111,7 +111,7 @@ class ExposedPaginationExtensionKtTest { val id = long("id") val name = varchar("name",100) - override val primaryKey: PrimaryKey? + override val primaryKey: PrimaryKey get() = PrimaryKey(id) } From b64b43a5562c1056b3257d2272ea5a8dff550614 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Sun, 4 Feb 2024 16:17:46 +0900 Subject: [PATCH 5/6] =?UTF-8?q?chore:=20spring=20framework=E3=81=AE?= =?UTF-8?q?=E4=BB=AE=E6=83=B3=E3=82=B9=E3=83=AC=E3=83=83=E3=83=89=E6=A9=9F?= =?UTF-8?q?=E8=83=BD=E3=82=92=E6=9C=89=E5=8A=B9=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 2208876e..87da1774 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -37,6 +37,9 @@ spring: h2: console: enabled: true + threads: + virtual: + enabled: true server: tomcat: basedir: tomcat @@ -44,4 +47,4 @@ server: enabled: true max-http-form-post-size: 40MB max-swallow-size: 40MB - port: 8081 + port: 8081 \ No newline at end of file From bd03c8dc35f48b1fa2c06595f7790f58de17ca73 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Sun, 4 Feb 2024 16:19:33 +0900 Subject: [PATCH 6/6] =?UTF-8?q?chore:=20GitHub=20Actions=E3=81=AEJDK?= =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=9221?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/pull-request-merge-check.yml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pull-request-merge-check.yml b/.github/workflows/pull-request-merge-check.yml index 86dd05bf..243369a7 100644 --- a/.github/workflows/pull-request-merge-check.yml +++ b/.github/workflows/pull-request-merge-check.yml @@ -53,10 +53,10 @@ jobs: build key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/*.kt') }}-${{ github.sha }} - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '21' distribution: 'temurin' - name: Build uses: gradle/gradle-build-action@v2.8.1 @@ -104,10 +104,10 @@ jobs: build key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }} - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '21' distribution: 'temurin' - name: Unit Test @@ -163,10 +163,10 @@ jobs: build key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }} - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '21' distribution: 'temurin' - name: MongoDB in GitHub Actions @@ -227,10 +227,10 @@ jobs: build key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }} - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '21' distribution: 'temurin' - name: Run Kover @@ -322,10 +322,10 @@ jobs: build key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }} - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '21' distribution: 'temurin' - name: Build with Gradle @@ -380,10 +380,10 @@ jobs: build key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }} - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '21' distribution: 'temurin' - name: MongoDB in GitHub Actions