POST /api/sessions- User login. Body:{username, password}. Returns user info and canDoTotp flag.POST /api/login-totp- TOTP verification for 2FA users. Body:{code}. Returns success confirmation.DELETE /api/sessions/current- User logout. Returns 204.GET /api/sessions/current- Get current user information.
GET /api/reservations- Retrieve all reservations for the logged-in user (auth required).POST /api/reservations- Create new reservation (auth required, TOTP required for first class). Body:{class, seats}.DELETE /api/reservations/:id- Delete user's reservation (auth required).
GET /api/seats/:class- Get seat information for specific class (first/second/economy). Returns counts and occupied seats.GET /api/seats/:class/user- Get user's reserved seats for specific class (auth required).
- users:
id(PK),username(unique),name,hash,salt,totp_secret
Stores user credentials and 2FA secrets. - reservations:
id(PK),user_id(FK),class(first/second/economy)
Stores reservations made by users. - reservation_seats:
id(PK),reservation_id(FK),row,seat
Stores individual seats associated with each reservation.
/- Home page showing train seat statistics and public information for all classes./login- Authentication page with username/password and conditional TOTP verification./totp- Two-factor authentication (2FA) page for users with TOTP enabled./reservations- Protected route for authenticated users to view and manage seat reservations.*- Not found page for undefined routes.
App- Root component managing authentication, routing, and global state.MainLayout- Main layout wrapper with navigation and outlet for child routes.HomePage- Public landing page displaying seat statistics for all travel classes.LoginForm- Authentication form for username and password.ReservationPage- Protected page for viewing and managing user reservations.ReservationPanel- Panel for creating new reservations and selecting class.Navbar- Navigation bar with user info and login/logout controls.ClassSelector- Component for selecting travel class (first/second/economy).SeatGrid- Interactive seat selection grid showing available, occupied, and user seats.ConfirmationModal- Modal dialog for confirming user actions.
- Username:
cla| Password:pwd| 2FA: Enabled | 2 reservations in first class - Username:
matte| Password:pwd| 2FA: Enabled | 2 reservations in different classes
- Username:
eric| Password:pwd| 2FA: Disabled | 1 reservation in each class - Username:
marco| Password:pwd| 2FA: Disabled | without reservations - Username:
ale| Password:pwd| 2FA: Disabled | without reservations


