2020-09-20 09:17:08 +00:00
|
|
|
import express from 'express'
|
|
|
|
|
import * as db from './db.js'
|
|
|
|
|
import {AVATAR, SQL_ORDER} from "./db.js";
|
|
|
|
|
|
|
|
|
|
const api = express.Router();
|
|
|
|
|
|
|
|
|
|
api.get('/char_stats/:batch', async (req, res, next) => {
|
|
|
|
|
try {
|
|
|
|
|
const stats = await db.get_stats();
|
|
|
|
|
|
|
|
|
|
stats.empires = { "TR": 0, "NC": 0, "VS": 0 }
|
|
|
|
|
|
|
|
|
|
var batch = req.params.batch;
|
|
|
|
|
|
|
|
|
|
const avatars = await db.get_character_batch_for_stats(batch, AVATAR.ID, SQL_ORDER.ASCENDING);
|
|
|
|
|
|
|
|
|
|
res.status(200).json({ players: avatars });
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log(e);
|
|
|
|
|
res.status(500).json({ message: 'error' });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2020-09-20 09:17:47 +00:00
|
|
|
api.get('/char_stats_bep/:batch', async (req, res, next) => {
|
|
|
|
|
try {
|
|
|
|
|
const stats = await db.get_stats();
|
|
|
|
|
|
|
|
|
|
stats.empires = { "TR": 0, "NC": 0, "VS": 0 }
|
|
|
|
|
|
|
|
|
|
var batch = req.params.batch;
|
|
|
|
|
|
|
|
|
|
const avatars = await db.get_character_batch_for_stats(batch, AVATAR.BEP, SQL_ORDER.DESCENDING);
|
|
|
|
|
|
|
|
|
|
res.status(200).json({ players: avatars });
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log(e);
|
|
|
|
|
res.status(500).json({ message: 'error' });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2020-09-20 09:18:09 +00:00
|
|
|
api.get('/char_stats_cep/:batch', async (req, res, next) => {
|
|
|
|
|
try {
|
|
|
|
|
const stats = await db.get_stats();
|
|
|
|
|
|
|
|
|
|
stats.empires = { "TR": 0, "NC": 0, "VS": 0 }
|
|
|
|
|
|
|
|
|
|
var batch = req.params.batch;
|
|
|
|
|
|
|
|
|
|
const avatars = await db.get_character_batch_for_stats(batch, AVATAR.CEP, SQL_ORDER.DESCENDING);
|
|
|
|
|
|
|
|
|
|
res.status(200).json({ players: avatars });
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log(e);
|
|
|
|
|
res.status(500).json({ message: 'error' });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2024-03-19 01:15:42 +00:00
|
|
|
api.get('/char_stats_kills', async (req, res, next) => {
|
|
|
|
|
try {
|
|
|
|
|
const kills = await db.get_killstats();
|
|
|
|
|
res.status(200).json({ kills: kills });
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log(e);
|
|
|
|
|
res.status(500).json({ message: 'error' });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2020-09-20 09:17:08 +00:00
|
|
|
export default api;
|