Skip to content

Commit

Permalink
feat(pollux): cleanup the code of IssueCredentialApi
Browse files Browse the repository at this point in the history
  • Loading branch information
yshyn-iohk committed Nov 29, 2022
1 parent 79170f8 commit 16d5fdb
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 283 deletions.
Expand Up @@ -13,15 +13,13 @@ import io.iohk.atala.agent.server.http.marshaller.{
DIDAuthenticationApiMarshallerImpl,
DIDOperationsApiMarshallerImpl,
DIDRegistrarApiMarshallerImpl,
IssueCredentialsApiMarshallerImpl,
ConnectionsManagementApiMarshallerImpl
}
import io.iohk.atala.agent.server.http.service.{
DIDApiServiceImpl,
DIDAuthenticationApiServiceImpl,
DIDOperationsApiServiceImpl,
DIDRegistrarApiServiceImpl,
IssueCredentialsApiServiceImpl,
ConnectionsManagementApiServiceImpl
}
import io.iohk.atala.castor.core.repository.DIDOperationRepository
Expand All @@ -30,7 +28,6 @@ import io.iohk.atala.agent.openapi.api.{
DIDAuthenticationApi,
DIDOperationsApi,
DIDRegistrarApi,
IssueCredentialsApi,
ConnectionsManagementApi
}
import io.iohk.atala.castor.sql.repository.{JdbcDIDOperationRepository, TransactorLayer}
Expand Down Expand Up @@ -378,13 +375,6 @@ object HttpModule {
(apiServiceLayer ++ apiMarshallerLayer) >>> ZLayer.fromFunction(new DIDRegistrarApi(_, _))
}

val issueCredentialsApiLayer: RLayer[DidComm, IssueCredentialsApi] = {
val serviceLayer = AppModule.credentialServiceLayer
val apiServiceLayer = serviceLayer >>> IssueCredentialsApiServiceImpl.layer
val apiMarshallerLayer = IssueCredentialsApiMarshallerImpl.layer
(apiServiceLayer ++ apiMarshallerLayer) >>> ZLayer.fromFunction(new IssueCredentialsApi(_, _))
}

val issueCredentialsProtocolApiLayer: RLayer[DidComm, IssueCredentialsProtocolApi] = {
val serviceLayer = AppModule.credentialServiceLayer
val apiServiceLayer = serviceLayer >>> IssueCredentialsProtocolApiServiceImpl.layer
Expand All @@ -400,7 +390,8 @@ object HttpModule {
}

val layers =
didApiLayer ++ didOperationsApiLayer ++ didAuthenticationApiLayer ++ didRegistrarApiLayer ++ issueCredentialsApiLayer ++ issueCredentialsProtocolApiLayer ++ connectionsManagementApiLayer
didApiLayer ++ didOperationsApiLayer ++ didAuthenticationApiLayer ++ didRegistrarApiLayer ++
issueCredentialsProtocolApiLayer ++ connectionsManagementApiLayer
}

object RepoModule {
Expand Down
Expand Up @@ -7,29 +7,27 @@ import io.iohk.atala.agent.openapi.api.{
DIDAuthenticationApi,
DIDOperationsApi,
DIDRegistrarApi,
IssueCredentialsApi,
IssueCredentialsProtocolApi,
ConnectionsManagementApi
}
import zio.*
import io.iohk.atala.agent.openapi.api.IssueCredentialsProtocolApi
import akka.http.scaladsl.server.Route

object HttpRoutes {

def routes: URIO[
DIDApi & DIDOperationsApi & DIDAuthenticationApi & DIDRegistrarApi & IssueCredentialsApi &
IssueCredentialsProtocolApi & ConnectionsManagementApi,
DIDApi & DIDOperationsApi & DIDAuthenticationApi & DIDRegistrarApi & IssueCredentialsProtocolApi &
ConnectionsManagementApi,
Route
] =
for {
didApi <- ZIO.service[DIDApi]
didOperationsApi <- ZIO.service[DIDOperationsApi]
didAuthApi <- ZIO.service[DIDAuthenticationApi]
disRegistrarApi <- ZIO.service[DIDRegistrarApi]
issueCredentialApi <- ZIO.service[IssueCredentialsApi]
issueCredentialsProtocolApi <- ZIO.service[IssueCredentialsProtocolApi]
connectionsManagementApi <- ZIO.service[ConnectionsManagementApi]
} yield didApi.route ~ didOperationsApi.route ~ didAuthApi.route ~ disRegistrarApi.route ~ issueCredentialApi.route ~ issueCredentialsProtocolApi.route ~ connectionsManagementApi.route ~ additionalRoute
} yield didApi.route ~ didOperationsApi.route ~ didAuthApi.route ~ disRegistrarApi.route ~ issueCredentialsProtocolApi.route ~ connectionsManagementApi.route ~ additionalRoute

private def additionalRoute: Route = {
// swagger-ui expects this particular header when resolving relative $ref
Expand Down

This file was deleted.

Expand Up @@ -77,20 +77,10 @@ trait JsonSupport extends SprayJsonSupport with DefaultJsonProtocol {
//

// Pollux
given RootJsonFormat[CreateCredentials201Response] = jsonFormat3(CreateCredentials201Response.apply)
given RootJsonFormat[CreateCredentialsRequest] = jsonFormat1(CreateCredentialsRequest.apply)
given RootJsonFormat[RevocationStatus] = jsonFormat2(RevocationStatus.apply)
given RootJsonFormat[W3CCredential] = jsonFormat6(W3CCredential.apply)
// given RootJsonFormat[W3CCredentialCredentialSubject] = jsonFormat1(W3CCredentialCredentialSubject.apply)
given RootJsonFormat[W3CCredentialInput] = jsonFormat4(W3CCredentialInput.apply)
// given RootJsonFormat[W3CCredentialInputClaims] = jsonFormat1(W3CCredentialInputClaims.apply)
given RootJsonFormat[W3CCredentialRevocationRequest] = jsonFormat1(W3CCredentialRevocationRequest.apply)
given RootJsonFormat[W3CCredentialRevocationResponse] = jsonFormat2(W3CCredentialRevocationResponse.apply)
given RootJsonFormat[W3CCredentialsPaginated] = jsonFormat4(W3CCredentialsPaginated.apply)
given RootJsonFormat[W3CCredentialStatus] = jsonFormat2(W3CCredentialStatus.apply)
given RootJsonFormat[W3CIssuanceBatch] = jsonFormat3(W3CIssuanceBatch.apply)
given RootJsonFormat[W3CIssuanceBatchAction] = jsonFormat3(W3CIssuanceBatchAction.apply)
given RootJsonFormat[W3CIssuanceBatchPaginated] = jsonFormat4(W3CIssuanceBatchPaginated.apply)
given RootJsonFormat[W3CPresentation] = jsonFormat1(W3CPresentation.apply)
given RootJsonFormat[W3CPresentationInput] = jsonFormat1(W3CPresentationInput.apply)
given RootJsonFormat[W3CPresentationPaginated] = jsonFormat4(W3CPresentationPaginated.apply)
Expand Down

This file was deleted.

Expand Up @@ -3,7 +3,6 @@ package io.iohk.atala.agent.server.http.service
import akka.http.scaladsl.server.Directives.*
import akka.http.scaladsl.marshalling.ToEntityMarshaller
import akka.http.scaladsl.server.Route
import io.iohk.atala.agent.openapi.api.IssueCredentialsApi
import io.iohk.atala.agent.openapi.api.IssueCredentialsProtocolApiService
import zio.*
import io.iohk.atala.pollux.core.service.CredentialService
Expand Down

0 comments on commit 16d5fdb

Please sign in to comment.