mirror of
https://github.com/psforever/PSFPortal.git
synced 2026-03-24 14:49:09 +00:00
leaderboard and weapon stats
This commit is contained in:
parent
bd5e3c9043
commit
67708b166d
7 changed files with 528 additions and 0 deletions
21
api/db.js
21
api/db.js
|
|
@ -70,6 +70,16 @@ export const AVATAR = Object.freeze({
|
|||
CEP: Symbol("cep"),
|
||||
});
|
||||
|
||||
export const WEAPONSTAT = Object.freeze({
|
||||
THIS: Symbol("weapon"),
|
||||
ID: Symbol("avatar_id"),
|
||||
WEAPON: Symbol("weapon_id"),
|
||||
SHOTS_FIRED: Symbol("shots_fired"),
|
||||
SHOTS_LANDED: Symbol("shots_landed"),
|
||||
KILLS: Symbol("kills"),
|
||||
ASSISTS: Symbol("assists")
|
||||
});
|
||||
|
||||
export const LOGIN = Object.freeze({
|
||||
THIS: Symbol("login"),
|
||||
ID: Symbol("id"),
|
||||
|
|
@ -322,6 +332,17 @@ export async function get_character_batch_for_stats(batch, sort, order) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function get_weaponstats_by_avatar(id) {
|
||||
try {
|
||||
const weapons = await pool.query('SELECT * FROM weaponstat WHERE avatar_id=$1 ORDER BY kills DESC', [id])
|
||||
return weapons.rows;
|
||||
} catch (e) {
|
||||
if (e.code)
|
||||
e.code = pg_error_inv[e.code]
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
export async function get_characters_by_account(account_id) {
|
||||
try {
|
||||
const characters = await pool.query('SELECT * FROM avatar WHERE account_id=$1 AND deleted=false', [account_id])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue