Built: units/research/training, movements (scan, raid, attack, takeover, reinforce, settle, transport), deterministic combat resolved in the event queue, reports, power/offline units, founding + conquest + incumbent sites; alliances, roles, diplomacy (24h pact cancel via events), messages, rankings; vanilla-JS phone-first client (auth, POP, map, alerts, settings, en/nb); systemd units, backup timer, DEPLOY.md, tools/admin.js. Tested: npm test 96/96 (fake clock, in-memory db, a few real-HTTP tests); client checked with headless Chromium screenshots only. NOT done: marketplace/transport trade, client screens for military/social, WebSocket push, bots/balance, e2e suite. All unit stats and costs are unbalanced first guesses. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
28 lines
1.6 KiB
JavaScript
28 lines
1.6 KiB
JavaScript
'use strict';
|
|
/* Rankings (stage 5): operators by footprint, alliances by summed footprint, attackers/defenders by battle points. */
|
|
const { createSocialQueries } = require('../socialQueries');
|
|
const D = require('../../public/js/data.js');
|
|
|
|
const q = (extra) => ({ type: 'object', properties: Object.assign({
|
|
worldId: { type: 'integer', minimum: 1 }, after: { type: 'integer', minimum: 0 }, limit: { type: 'integer', minimum: 1, maximum: D.SOCIAL.rankingsPageMax },
|
|
}, extra || {}) });
|
|
|
|
function register(router, services) {
|
|
const social = createSocialQueries(services);
|
|
const errs = ['unauthorized', 'not_found', 'validation_failed'];
|
|
|
|
router.get('/rankings/operators', {
|
|
summary: 'Operators by footprint (cursor: after = number of ranks already seen)', tag: 'rankings', query: q(), response: { $ref: 'RankOperators' }, errors: errs,
|
|
}, ({ user, query }) => social.rankOperators(user.id, query));
|
|
|
|
router.get('/rankings/alliances', {
|
|
summary: 'Alliances by summed footprint of their members', tag: 'rankings', query: q(), response: { $ref: 'RankAlliances' }, errors: errs,
|
|
}, ({ user, query }) => social.rankAlliances(user.id, query));
|
|
|
|
router.get('/rankings/battles', {
|
|
summary: 'Attackers / defenders by battle points (`by`: attack, defense or total). Empty with available=false until the military stage records points', tag: 'rankings',
|
|
query: q({ by: { type: 'string', enum: ['attack', 'defense', 'total'] } }), response: { $ref: 'RankBattles' }, errors: errs,
|
|
}, ({ user, query }) => social.rankBattles(user.id, query));
|
|
}
|
|
|
|
module.exports = { register };
|