feat(api): world/system/crew snapshots expose the active + pending task queue (#44)
This commit is contained in:
+49
-5
@@ -199,14 +199,14 @@ export const openApiSpec = {
|
||||
get: {
|
||||
summary: 'Crew roster',
|
||||
description:
|
||||
'The ship crew in join order — the starting crew (seeded on new game) plus members found while exploring planets/moons. Each member has one good and one bad trait and an origin. Auto-initializes a new game when no save exists yet.',
|
||||
'The ship crew in join order — the starting crew (seeded on new game) plus members found while exploring planets/moons — returned as the { crew, tasks } object, wrapped with the active + pending task queue. Each member has one good and one bad trait and an origin. Auto-initializes a new game when no save exists yet.',
|
||||
operationId: 'getCrew',
|
||||
responses: {
|
||||
200: {
|
||||
description: 'Crew roster',
|
||||
description: 'Crew roster plus the active + pending task queue',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: { type: 'array', items: { $ref: '#/components/schemas/CrewMember' } },
|
||||
schema: { $ref: '#/components/schemas/CrewState' },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -855,8 +855,13 @@ export const openApiSpec = {
|
||||
},
|
||||
},
|
||||
turn: { type: 'integer', description: 'Turn counter — advances on the turn tick; queued actions (jump, exploration, ship work, research) cost no turn, and mission accept is free' },
|
||||
tasks: {
|
||||
type: 'array',
|
||||
description: 'The active + pending task queue — the ACTIVE block first, then the PENDING block, each ordered by (queuedAtTurn, id); DONE rows never appear',
|
||||
items: { $ref: '#/components/schemas/TaskDto' },
|
||||
},
|
||||
},
|
||||
required: ['systems', 'edges', 'turn'],
|
||||
required: ['systems', 'edges', 'turn', 'tasks'],
|
||||
},
|
||||
TurnResult: {
|
||||
allOf: [
|
||||
@@ -894,6 +899,23 @@ export const openApiSpec = {
|
||||
},
|
||||
required: ['id', 'saveId', 'type', 'payload', 'leadCrewId', 'helpers', 'duration', 'remaining', 'status', 'queuedAtTurn'],
|
||||
},
|
||||
TaskDto: {
|
||||
type: 'object',
|
||||
description: 'One row of the snapshot task queue — the ACTIVE + PENDING rows of the tasks table as the GET snapshots expose them (DONE rows never appear)',
|
||||
properties: {
|
||||
id: { type: 'integer' },
|
||||
type: { type: 'string', enum: ['JUMP', 'EXPLORE', 'SHIP_UPGRADE', 'SHIP_EXPAND', 'SHIP_BUILD', 'RESEARCH'] },
|
||||
targetLabel: {
|
||||
type: 'string',
|
||||
description:
|
||||
'The task target by display name — the jump destination, the scanned body, the ship system with the verb suffixed (e.g. Origin — upgrade), the built system type, or the researched tech; `unknown` when the target row no longer exists',
|
||||
},
|
||||
leadName: { type: 'string', description: 'The team lead by name; `unknown` when the crew row no longer exists' },
|
||||
helperNames: { type: 'array', description: 'The supporting crew by name (empty when none)', items: { type: 'string' } },
|
||||
remaining: { type: 'integer', description: 'Turns left — the stored row value (a pure read, not recomputed)' },
|
||||
},
|
||||
required: ['id', 'type', 'targetLabel', 'leadName', 'helperNames', 'remaining'],
|
||||
},
|
||||
JumpRequest: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@@ -949,6 +971,23 @@ export const openApiSpec = {
|
||||
},
|
||||
required: ['id', 'name', 'role', 'trait_good', 'trait_bad', 'origin'],
|
||||
},
|
||||
CrewState: {
|
||||
type: 'object',
|
||||
description: 'GET /api/crew response — the roster wrapped with the snapshot task queue (a bare array cannot carry a sibling tasks field)',
|
||||
properties: {
|
||||
crew: {
|
||||
type: 'array',
|
||||
description: 'The ship crew in join order — the starting crew (seeded on new game) plus members found while exploring',
|
||||
items: { $ref: '#/components/schemas/CrewMember' },
|
||||
},
|
||||
tasks: {
|
||||
type: 'array',
|
||||
description: 'The active + pending task queue — the ACTIVE block first, then the PENDING block, each ordered by (queuedAtTurn, id); DONE rows never appear',
|
||||
items: { $ref: '#/components/schemas/TaskDto' },
|
||||
},
|
||||
},
|
||||
required: ['crew', 'tasks'],
|
||||
},
|
||||
ShipSystem: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@@ -1087,8 +1126,13 @@ export const openApiSpec = {
|
||||
},
|
||||
inventory: { type: 'array', items: { $ref: '#/components/schemas/InventoryItem' } },
|
||||
turn: { type: 'integer', description: 'Turn counter — advances on the turn tick; queued actions (jump, exploration, ship work, research) cost no turn, and mission accept is free' },
|
||||
tasks: {
|
||||
type: 'array',
|
||||
description: 'The active + pending task queue — the ACTIVE block first, then the PENDING block, each ordered by (queuedAtTurn, id); DONE rows never appear',
|
||||
items: { $ref: '#/components/schemas/TaskDto' },
|
||||
},
|
||||
},
|
||||
required: ['systemId', 'systemName', 'planets', 'inventory', 'turn'],
|
||||
required: ['systemId', 'systemName', 'planets', 'inventory', 'turn', 'tasks'],
|
||||
},
|
||||
ExploreRequest: {
|
||||
type: 'object',
|
||||
|
||||
Reference in New Issue
Block a user