diff --git a/mentions/build.gradle.kts b/mentions/build.gradle.kts index 699d34fe..32f66396 100644 --- a/mentions/build.gradle.kts +++ b/mentions/build.gradle.kts @@ -54,6 +54,17 @@ kotlin { explicitApi() } +/** + * Kotlin code compilation task waits until + * Protobuf files are fully generated and rejections are created. + */ +// TODO:2024-05-20:mykyta.pimonov: Rewrite the way of organizing tasks, +// using task inputs and outputs. +// See: https://github.com/spine-examples/Pingh/pull/7#discussion_r1607043747. +tasks.named("compileKotlin") { + dependsOn("generateRejections") +} + dependencies { implementation(project(":github")) implementation(project(":sessions")) diff --git a/sessions/src/main/kotlin/io/spine/examples/pingh/sessions/SessionsContext.kt b/sessions/src/main/kotlin/io/spine/examples/pingh/sessions/SessionsContext.kt index 00a07c08..b3e73437 100644 --- a/sessions/src/main/kotlin/io/spine/examples/pingh/sessions/SessionsContext.kt +++ b/sessions/src/main/kotlin/io/spine/examples/pingh/sessions/SessionsContext.kt @@ -39,4 +39,4 @@ public const val NAME: String = "Sessions" */ public fun newBuilder(): BoundedContextBuilder = BoundedContext.singleTenant(NAME) - .add(UserSessionRepository()) + .add(UserSessionProcess::class.java) diff --git a/sessions/src/main/kotlin/io/spine/examples/pingh/sessions/UserSessionRepository.kt b/sessions/src/main/kotlin/io/spine/examples/pingh/sessions/UserSessionRepository.kt deleted file mode 100644 index c4b6197d..00000000 --- a/sessions/src/main/kotlin/io/spine/examples/pingh/sessions/UserSessionRepository.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2024, TeamDev. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package io.spine.examples.pingh.sessions - -import com.google.errorprone.annotations.OverridingMethodsMustInvokeSuper -import io.spine.examples.pingh.sessions.event.UserLoggedIn -import io.spine.examples.pingh.sessions.event.UserLoggedOut -import io.spine.server.procman.ProcessManagerRepository -import io.spine.server.route.EventRoute.withId -import io.spine.server.route.EventRouting - -/** - * Manages instances of [UserSessionProcess]. - */ -public class UserSessionRepository : - ProcessManagerRepository() { - - @OverridingMethodsMustInvokeSuper - override fun setupEventRouting(routing: EventRouting) { - super.setupEventRouting(routing) - routing - .route(UserLoggedIn::class.java) { event, _ -> - withId(event.id) - } - .route(UserLoggedOut::class.java) { event, _ -> - withId(event.id) - } - } -}