PT OPS

FIDO: Train Claims

Tracks which TIOS user has claimed (is actively handling) a given train.

Last updated: October 8, 2026

User references (tiosUser) are MongoDB user IDs (24-character hex strings), not usernames.

GET /fido/trainClaims Authentication required

Returns all train claims as an array ([] if none).

[ { "_id": "665f...", "trainNumber": "301", "tiosUser": "665f1a0c9b1e8a0012a4b7a1", "__v": 0 } ]
GET /fido/trainClaims/train/:trainNumber Authentication required

Returns the claim for a specific train as a single object, or 404 with { "error": "Train claim not found" }.

{ "_id": "665f...", "trainNumber": "301", "tiosUser": "665f1a0c9b1e8a0012a4b7a1", "__v": 0 }
GET /fido/trainClaims/user/:tiosUser Authentication required

Returns an array of all claims held by a specific user, where :tiosUser is the user's MongoDB ID (same shape as GET /fido/trainClaims), or 404 with { "error": "No train claims found for this user" } if there are none.

POST /fido/trainClaims Authentication required
{ "trainNumber": "301", "tiosUser": "665f1a0c9b1e8a0012a4b7a1" }
GET /fido/trainsWithClaims Authentication required

Returns an array of every train document (same shape as GET /trains) with an extra tiosUser field, set to the claiming user's MongoDB ID or null when unclaimed.

POST /fido/trainClaims/:trainNumber/claim Authentication required
{ "tiosUser": "665f1a0c9b1e8a0012a4b7a1" }

Creates a claim for the train. Returns 409 if a claim already exists; use DELETE /fido/trainClaims/:trainNumber before creating a different claim.

GET /fido/detailedTrainInfo/:trainNumber Authentication required

Returns the train, its claim, active announcements relevant to its current route, and station staffing information added to each current-route stop when a staffing record exists.

Response

{
  "trainInfo": {
    "trainNumber": "301",
    "currentRoute": [
      { "code": "SK", "staffingType": "dispatcher" }
    ]
  },
  "claim": { "trainNumber": "301", "tiosUser": "665f1a0c9b1e8a0012a4b7a1" },
  "announcements": []
}

claim is null when the train has no claim. Stations with a staffing record return its staffing type, or "unstaffed" when the station is not staffed.

DELETE /fido/trainClaims/:trainNumber Authentication required

Releases the claim on a train.