-
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): implement pagination with navigation for schema-re…
…gistry (#195)
- Loading branch information
1 parent
6d6af93
commit 726e2d9
Showing
15 changed files
with
430 additions
and
111 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
prism-agent/service/server/src/main/scala/io/iohk/atala/api/http/RequestContext.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,5 @@ | ||
package io.iohk.atala.api.http | ||
|
||
import sttp.tapir.model.ServerRequest | ||
|
||
case class RequestContext(request: ServerRequest) |
3 changes: 3 additions & 0 deletions
3
prism-agent/service/server/src/main/scala/io/iohk/atala/api/http/model/CollectionStats.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,3 @@ | ||
package io.iohk.atala.api.http.model | ||
|
||
case class CollectionStats(totalCount: Int, filteredCount: Int) |
15 changes: 0 additions & 15 deletions
15
prism-agent/service/server/src/main/scala/io/iohk/atala/api/http/model/Pagination.scala
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
prism-agent/service/server/src/main/scala/io/iohk/atala/api/http/model/PaginationInput.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,27 @@ | ||
package io.iohk.atala.api.http.model | ||
|
||
import sttp.tapir.Codec.PlainCodec | ||
import sttp.tapir.generic.auto.* | ||
import sttp.tapir.{Codec, DecodeResult, Schema} | ||
import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder} | ||
|
||
import java.time.ZonedDateTime | ||
import java.util.{Base64, UUID} | ||
import scala.util.Try | ||
|
||
case class PaginationInput( | ||
offset: Option[Int] = None, | ||
limit: Option[Int] = None | ||
) { | ||
def toPagination = Pagination.apply(this) | ||
} | ||
|
||
case class Pagination(offset: Int, limit: Int) { | ||
def next = copy(offset = offset + limit) | ||
def prev = copy(offset = Math.max(offset - limit, 0)) | ||
} | ||
|
||
object Pagination { | ||
def apply(in: PaginationInput): Pagination = | ||
Pagination(in.offset.getOrElse(0), in.limit.getOrElse(100)) | ||
} |
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
Oops, something went wrong.