Add POST /me/join and a join card: accounts survive a world reset

Found while resetting the live test world: joinWorld's comment promised POST /worlds/:id/join but no route existed, so after reset-world (accounts kept) nobody could found a POP again. Added POST /me/join (default: first running world; 409 if already joined), a join card on the POP screen, en/nb strings, API.md + openapi. Client no longer polls /movements while it has no operator (that 404ed).

Tested: npm test 209/209 (new test/me-join.test.js incl. response contract), openapi check, npm run e2e (new check: account without a POP sees the join card and founds one). NOT tested: joining a second/other world (only the default-world path in the browser), nb text of the card visually.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
jvanvik 2026-10-11 22:43:15 +02:00
parent bf7af0679c
commit 9104480463
9 changed files with 170 additions and 6 deletions

View file

@ -3533,6 +3533,99 @@
}
}
},
"/me/join": {
"post": {
"summary": "Join a world with this account: creates the operator and its capital POP (default: the first running world)",
"tags": [
"me"
],
"operationId": "postMeJoin",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"worldId": {
"type": "integer",
"minimum": 1
}
}
}
}
}
},
"security": [
{
"bearer": []
}
],
"responses": {
"201": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Me"
}
}
}
},
"401": {
"description": "Error codes: unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Error codes: not_found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"409": {
"description": "Error codes: conflict, world_full",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"422": {
"description": "Error codes: idempotency_key_reuse, validation_failed",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"500": {
"description": "Error codes: internal_error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/messages": {
"post": {
"summary": "Send a message to an operator (toOperatorId or toName) or to your alliance (toAlliance). Plain text, max 2000 characters, rate-limited",