[+] Paged post process

This commit is contained in:
Azalea
2024-12-28 00:18:15 -05:00
parent 0632213c8b
commit da61b1a3e7
3 changed files with 19 additions and 10 deletions

View File

@@ -88,7 +88,7 @@ val chusanInit: ChusanController.() -> Unit = {
// Paged user list endpoints that has a kind in their request
"GetUserActivity".pagedWithKind("userActivityList") {
val kind = parsing { data["kind"]!!.int }
mapOf("kind" to kind) to {
mapOf("kind" to kind) grabs {
db.userActivity.findAllByUser_Card_ExtIdAndKind(uid, kind).sortedBy { -it.sortNumber }
}
}
@@ -97,15 +97,17 @@ val chusanInit: ChusanController.() -> Unit = {
val rawIndex = data["nextIndex"]!!.long
val kind = parsing { (rawIndex / 10000000000L).int }
data["nextIndex"] = rawIndex % 10000000000L
mapOf("itemKind" to kind) to {
mapOf("itemKind" to kind) grabs {
// TODO: All unlock
db.userItem.findAllByUser_Card_ExtIdAndItemKind(uid, kind)
} postProcess {
it["nextIndex"] = rawIndex + (kind * 10000000000L)
}
}
"GetUserFavoriteItem".pagedWithKind("userFavoriteItemList") {
val kind = parsing { data["kind"]!!.int }
mapOf("kind" to kind) to {
mapOf("kind" to kind) grabs {
// TODO: Actually store this info at UpsertUserAll
val fav = when (kind) {
1 -> "favorite_music"