Tabla de Clasificación
POSITION
NAME
SCORE
DATE
1
MANUELA RECIO GOMEZ
900
29-08-2016
2
JUAN CAMILO RIOS QUINTERO
700
26-08-2016
3
JUAN DAVID NICHOLLS C.
4
HÉCTOR ALZATE
600
28-08-2016
5
500
24-08-2016
6
450
22-08-2016
Stores players scores and sorts them in a leaderboard
Level 1
Url: /users/{id}
Response: 200 (application/json) {
"username": "juan.riosq",
"name": "Juan Camilo Rios Quintero", "score": 700,
"updated_at": "2017-08-26T13:18:05" }
Request: (application/json) {
"score": 900, "level": 1
}
Url: /leaderboard/{levelId}/{userId}
"position": 1,
"score": 900,
"updated_at": "2017-08-29T13:18:05" }
Url: /leaderboard/{levelId}{?pageSize,page}
Response: 200 (application/json) { [ { "position": 1, "name": "Manuela", "username": "rawrcrush", "score": 500 }, { "position": 2, "id": "HFG0555", "name": "rawrcrush", "score": 500 }, }
https://app.apiary.io/leaderboard13
row_number() OVER(ORDER BY score DESC, date ASC) as position
var page = Number(req.query.page) || 1; var limit = Number(req.query.pageSize) || 10; var offset = (page - 1) * limit; db.query(` SELECT * ... LIMIT $1 OFFSET $2 `, [limit, offset])
By J.D Nicholls
Founder at @marketx_ai | Digital nomad 🎒 | Mentor 👨🏫 | Speaker 🗣️ | Developer 👨💻 | Creator of @proyecto26 #opensource #developer