Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package hu.bme.mit.ftsrg.dva.api

import com.rabbitmq.client.Connection
import com.rabbitmq.client.ConnectionFactory
import hu.bme.mit.ftsrg.dva.api.db.*
import hu.bme.mit.ftsrg.dva.api.err.addHandlers
import hu.bme.mit.ftsrg.dva.api.rabbit.connectWithRetry
import hu.bme.mit.ftsrg.dva.api.route.*
import hu.bme.mit.ftsrg.dva.log.ReqestLogRepo
import hu.bme.mit.ftsrg.dva.log.VerifRequestLogRepo
import hu.bme.mit.ftsrg.dva.vla.TemplateRepo
import hu.bme.mit.ftsrg.dva.vla.VLARepo
import io.ktor.client.*
import io.ktor.client.engine.cio.CIO
import io.ktor.http.*
Expand Down Expand Up @@ -61,15 +56,7 @@ fun Application.installPlugins() {
}

fun Application.configureKoin() {
val rabbitHost = environment.config.property("rabbitmq.host").getString()

val appModule = module {
single<Connection> {
ConnectionFactory().run {
host = rabbitHost
connectWithRetry(logger = log)
}
}
single<HttpClient> {
HttpClient(CIO) {
install(ClientContentNegotiation) {
Comment on lines 58 to 62
Expand All @@ -80,20 +67,15 @@ fun Application.configureKoin() {
}
}
}
single<TemplateRepo> { PgTemplateRepo() }
single<ReqestLogRepo> { PgRequestLogRepo() }
single<VerifRequestLogRepo> { PgVerifRequestLogRepo() }
single<VLARepo> { PgVLARepo() }
}

serverInstall(Koin) { modules(appModule) }
}

fun Application.addRoutes() {
docRoutes(openapiPath = environment.config.property("swagger.openapiFile").getString())
templateRoutes()
aovRoutes()
vlaRoutes()
evaluationRoutes()
infoRoutes()
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package hu.bme.mit.ftsrg.dva.api.route
import com.rabbitmq.client.Connection
import com.rabbitmq.client.MessageProperties
import hu.bme.mit.ftsrg.dva.api.resource.Attestations
import hu.bme.mit.ftsrg.dva.dto.ErrDTO
import hu.bme.mit.ftsrg.dva.dto.IDDTO
import hu.bme.mit.ftsrg.dva.dto.aov.ACAPyPresentationRequestDTO
import hu.bme.mit.ftsrg.dva.dto.aov.ACAPyPresentationResponseDTO
Expand Down Expand Up @@ -103,18 +104,25 @@ fun Application.aovRoutes() {
)
)
}
val acaPyResp: ACAPyPresentationResponseDTO = resp.body()
if (!resp.status.isSuccess()) {
call.respond(
resp.status,
ErrDTO(type = "ACAPY_${resp.status.value}", title = resp.bodyAsText()),
)
} else {
val acaPyResp: ACAPyPresentationResponseDTO = resp.body()

if (verifLogEntity != null) {
verifsRepo.update(
VerifRequestLogPatch(
id = verifLogEntity.id,
presentationRequestData = acaPyResp.aov,
if (verifLogEntity != null) {
verifsRepo.update(
VerifRequestLogPatch(
id = verifLogEntity.id,
presentationRequestData = acaPyResp.aov,
)
)
)
}
}

call.respond(status = resp.status, message = acaPyResp)
call.respond(status = resp.status, message = acaPyResp)
}
}
}
}
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading