Created
February 12, 2019 08:43
-
-
Save terjokhin/3acf7986ded18a9d785859081cec2451 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def getBlocks: Route = (get & paging & sorting(sortByFieldMappings, Some("height")) & startEndDate) { | |
(o, l, field, so, start, end) => | |
val sTs = start.getOrElse(0L) | |
val eTs = end.getOrElse(System.currentTimeMillis() + oneDayMillis) | |
val p = Paging(offset = o, limit = l) | |
val s = Sorting(sortBy = field, order = so) | |
val items = bs.getBlocks(p, s, sTs, eTs) | |
val count = bs.count(sTs, eTs) | |
val itemsResponse = (items, count).parMapN(ItemsResponse.apply) | |
itemsResponse | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment