Stage 3-5 server (military, expansion, social), web client for stages 1-2, ops/deploy
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
This commit is contained in:
parent
b56b13880e
commit
249818a7aa
111 changed files with 17472 additions and 13 deletions
15
server/commands/allianceInviteCancel.js
Normal file
15
server/commands/allianceInviteCancel.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
'use strict';
|
||||
/* DELETE /alliances/:id/invites/:inviteId. Needs `cancelInvite`. Idempotent for an already cancelled invite. */
|
||||
const { GameError } = require('../errors');
|
||||
const A = require('../alliances');
|
||||
|
||||
module.exports = function allianceInviteCancel(ctx, { userId, allianceId, inviteId }) {
|
||||
const { db, now } = ctx;
|
||||
const { alliance } = A.requireRole(db, userId, allianceId, 'cancelInvite');
|
||||
const inv = db.get('SELECT id, status FROM alliance_invites WHERE id = ? AND alliance_id = ?', inviteId, alliance.id);
|
||||
if (!inv) throw new GameError('not_found', { what: 'invite' });
|
||||
if (inv.status === 'cancelled') return { changed: false };
|
||||
if (inv.status !== 'pending') throw new GameError('conflict', { what: 'invite is ' + inv.status });
|
||||
db.run("UPDATE alliance_invites SET status = 'cancelled', answered_at = ? WHERE id = ?", now, inv.id);
|
||||
return { changed: true };
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue