-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from lenguyenthanh/remove-one-paginator
We have two paginators 😱
- Loading branch information
Showing
4 changed files
with
26 additions
and
183 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
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,24 @@ | ||
package scalalib | ||
|
||
import play.api.libs.json.{ Json as PlayJson, * } | ||
import scalalib.json.Json.* | ||
import scalalib.model.MaxPerPage | ||
import scalalib.paginator.Paginator | ||
|
||
object Json: | ||
export scalalib.json.Json.{ *, given } | ||
export scalalib.json.extensions.{ *, given } | ||
|
||
given Writes[MaxPerPage] with | ||
def writes(m: MaxPerPage) = JsNumber(m.value) | ||
|
||
given paginatorWrite[A: Writes]: OWrites[Paginator[A]] = OWrites[Paginator[A]]: p => | ||
PlayJson.obj( | ||
"currentPage" -> p.currentPage, | ||
"maxPerPage" -> p.maxPerPage, | ||
"currentPageResults" -> p.currentPageResults, | ||
"nbResults" -> p.nbResults, | ||
"previousPage" -> p.previousPage, | ||
"nextPage" -> p.nextPage, | ||
"nbPages" -> p.nbPages | ||
) |
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