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
12
server/commands/messageRead.js
Normal file
12
server/commands/messageRead.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
'use strict';
|
||||
/* POST /messages/read { ids } or { all: true }: mark received messages read. Already-read ones are left alone. */
|
||||
module.exports = function messageRead(ctx, { userId, ids, all, worldId }) {
|
||||
const { db, now } = ctx;
|
||||
const ops = db.all(worldId !== undefined ? 'SELECT id FROM operators WHERE user_id = ? AND world_id = ?' : 'SELECT id FROM operators WHERE user_id = ?', userId, ...(worldId !== undefined ? [worldId] : []));
|
||||
let changed = 0;
|
||||
for (const o of ops) {
|
||||
if (all) changed += db.run('UPDATE message_recipients SET read_at = ? WHERE operator_id = ? AND read_at IS NULL AND deleted_at IS NULL', now, o.id).changes;
|
||||
else for (const id of ids || []) changed += db.run('UPDATE message_recipients SET read_at = ? WHERE operator_id = ? AND message_id = ? AND read_at IS NULL AND deleted_at IS NULL', now, o.id, id).changes;
|
||||
}
|
||||
return { changed: Number(changed) };
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue