-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(prism-agent): CredentialSchema DAL, model, service and repositor… (
#425) * feat(prism-agent): CredentialSchema DAL, model, service and repository integration * feat(prism-agent): scala formatter fix, pollux dependency update * tests: (wip) adjust e2e tests for the credential schema API * fix: e2e tests bugfixes * tests: adjust e2e tests for the credential schema API * chore: cleanup test and fix linter --------- Co-authored-by: Anton Baliasnikov <anton.baliasnikov@iohk.io>
- Loading branch information
1 parent
c830336
commit 32f9e83
Showing
38 changed files
with
1,136 additions
and
923 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/MainInMemory.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...-agent/service/server/src/main/scala/io/iohk/atala/agent/server/http/ZHttpEndpoints.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
.../src/main/scala/io/iohk/atala/pollux/credentialschema/SchemaRegistryServerEndpoints.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package io.iohk.atala.pollux.credentialschema | ||
|
||
import io.iohk.atala.api.http.model.{CollectionStats, Order, Pagination, PaginationInput} | ||
import io.iohk.atala.api.http.{FailureResponse, InternalServerError, NotFound, RequestContext} | ||
import io.iohk.atala.pollux.credentialschema.SchemaRegistryEndpoints.{ | ||
createSchemaEndpoint, | ||
getSchemaByIdEndpoint, | ||
lookupSchemasByQueryEndpoint, | ||
testEndpoint | ||
} | ||
import io.iohk.atala.pollux.credentialschema.controller.{CredentialSchemaController, CredentialSchemaControllerLogic} | ||
import io.iohk.atala.pollux.credentialschema.http.{ | ||
CredentialSchemaInput, | ||
CredentialSchemaPageResponse, | ||
CredentialSchemaResponse, | ||
FilterInput | ||
} | ||
import sttp.tapir.redoc.RedocUIOptions | ||
import sttp.tapir.redoc.bundle.RedocInterpreter | ||
import sttp.tapir.server.ServerEndpoint | ||
import sttp.tapir.swagger.bundle.SwaggerInterpreter | ||
import sttp.tapir.ztapir.* | ||
import zio.{Task, URIO, ZIO, ZLayer} | ||
|
||
import java.util.UUID | ||
|
||
class SchemaRegistryServerEndpoints( | ||
credentialSchemaController: CredentialSchemaController | ||
) { | ||
def throwableToInternalServerError(throwable: Throwable) = | ||
ZIO.fail[FailureResponse](InternalServerError(throwable.getMessage)) | ||
|
||
val createSchemaServerEndpoint: ZServerEndpoint[Any, Any] = | ||
createSchemaEndpoint.zServerLogic { case (ctx: RequestContext, schemaInput: CredentialSchemaInput) => | ||
credentialSchemaController.createSchema(schemaInput)(ctx) | ||
} | ||
|
||
val getSchemaByIdServerEndpoint: ZServerEndpoint[Any, Any] = | ||
getSchemaByIdEndpoint.zServerLogic { case (ctx: RequestContext, guid: UUID) => | ||
credentialSchemaController.getSchemaByGuid(guid)(ctx) | ||
} | ||
|
||
val lookupSchemasByQueryServerEndpoint: ZServerEndpoint[Any, Any] = | ||
lookupSchemasByQueryEndpoint.zServerLogic { | ||
case ( | ||
ctx: RequestContext, | ||
filter: FilterInput, | ||
paginationInput: PaginationInput, | ||
order: Option[Order] | ||
) => | ||
credentialSchemaController.lookupSchemas( | ||
filter, | ||
paginationInput.toPagination, | ||
order | ||
)(ctx) | ||
} | ||
|
||
val testServerEndpoint: ZServerEndpoint[Any, Any] = | ||
testEndpoint.zServerLogic(requestContext => ZIO.succeed(requestContext.request.toString)) | ||
|
||
val all: List[ZServerEndpoint[Any, Any]] = | ||
List( | ||
createSchemaServerEndpoint, | ||
getSchemaByIdServerEndpoint, | ||
lookupSchemasByQueryServerEndpoint, | ||
testServerEndpoint | ||
) | ||
} | ||
|
||
object SchemaRegistryServerEndpoints { | ||
def all: URIO[CredentialSchemaController, List[ZServerEndpoint[Any, Any]]] = { | ||
for { | ||
schemaRegistryService <- ZIO.service[CredentialSchemaController] | ||
schemaRegistryEndpoints = new SchemaRegistryServerEndpoints( | ||
schemaRegistryService | ||
) | ||
} yield schemaRegistryEndpoints.all | ||
} | ||
} |
Oops, something went wrong.