debt(pre-router): resolved most of the technical debt that was noted while finishing epic-12 and epic-13.
This commit is contained in:
@@ -16,7 +16,7 @@ import com.correx.core.events.events.ApprovalRequestedEvent
|
||||
import com.correx.core.events.types.ApprovalRequestId
|
||||
import com.correx.core.events.types.SessionId
|
||||
import com.correx.core.events.types.StageId
|
||||
import com.correx.core.kernel.orchestration.DefaultSessionOrchestrator
|
||||
import com.correx.core.kernel.orchestration.ApprovalGateway
|
||||
import com.correx.core.sessions.ApprovalMode
|
||||
import io.ktor.server.websocket.DefaultWebSocketServerSession
|
||||
import io.ktor.websocket.Frame
|
||||
@@ -28,7 +28,7 @@ import kotlinx.datetime.Clock
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
class ApprovalCoordinator(
|
||||
private val orchestrator: DefaultSessionOrchestrator,
|
||||
private val orchestrator: ApprovalGateway,
|
||||
private val config: ApprovalConfig,
|
||||
private val scope: CoroutineScope,
|
||||
) {
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
@file:Suppress("MatchingDeclarationName")
|
||||
|
||||
package com.correx.apps.server.routes
|
||||
|
||||
import com.correx.apps.server.approval.ApprovalCoordinator
|
||||
import com.correx.apps.server.protocol.ApprovalDecision
|
||||
import com.correx.apps.server.protocol.ClientMessage
|
||||
import com.correx.apps.server.protocol.ServerMessage
|
||||
import com.correx.core.events.types.ApprovalRequestId
|
||||
import com.correx.core.events.types.SessionId
|
||||
import com.correx.core.utils.TypeId
|
||||
@@ -43,7 +46,8 @@ fun Route.approvalRoutes(coordinator: ApprovalCoordinator) {
|
||||
)
|
||||
val error = coordinator.handleResponse(msg, sessionId)
|
||||
if (error != null) {
|
||||
call.respond(HttpStatusCode.Conflict, mapOf("error" to (error as? com.correx.apps.server.protocol.ServerMessage.ProtocolError)?.message))
|
||||
val msg = (error as? ServerMessage.ProtocolError)?.message
|
||||
call.respond(HttpStatusCode.Conflict, mapOf("error" to msg))
|
||||
} else {
|
||||
call.respond(HttpStatusCode.OK)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user