mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-13 23:07:28 +08:00
[+] Wacca: user/info/update
This commit is contained in:
@@ -308,6 +308,23 @@ fun WaccaServer.init() {
|
|||||||
|
|
||||||
empty
|
empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"user/info/update" { _, (uid, opts, _, dates, favAdd, favRem) ->
|
||||||
|
val u = user(uid) ?: (404 - "User not found")
|
||||||
|
|
||||||
|
// Update options
|
||||||
|
val o = rp.option.findByUser(u).associate { it.optId to it }
|
||||||
|
rp.option.saveAll((opts as List<List<Int>>).map { (k, v) -> o[k]?.apply { value = v }
|
||||||
|
?: WcUserOption(k, v).apply { user = u } })
|
||||||
|
|
||||||
|
// Update favorite songs
|
||||||
|
rp.user.save(u.apply { favoriteSongs.apply {
|
||||||
|
addAll(favAdd as List<Int>)
|
||||||
|
removeAll(favRem as List<Int>)
|
||||||
|
} })
|
||||||
|
|
||||||
|
empty
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user