Adding ticket generation and booking for staff employees logic

This commit is contained in:
Muluhabt
2026-07-25 11:20:47 +03:00
parent 7320c359d1
commit 2a0fd9bda5
29 changed files with 2659 additions and 74 deletions

View File

@@ -24,9 +24,9 @@ test("BC-11 ✅ travelMinutesToStop drives each stop's estimated arrival indepen
name: "E2E Check-in Cutoff Route",
effectiveFrom: "2020-01-01T00:00:00Z",
stops: [
{ stationId: STATIONS.A, sequence: 1 },
{ stationId: STATIONS.B, sequence: 2, travelMinutesToStop: 60 },
{ stationId: STATIONS.C, sequence: 3, travelMinutesToStop: 40 },
{ stationId: STATIONS.A, sequence: 1, distanceKm: 0 },
{ stationId: STATIONS.B, sequence: 2, travelMinutesToStop: 60, distanceKm: 60 },
{ stationId: STATIONS.C, sequence: 3, travelMinutesToStop: 40, distanceKm: 100 },
],
},
});

View File

@@ -71,7 +71,15 @@ test("BC-10 ✅ a schedule with a past departure is rejected by the API (past-da
const arr = new Date(dep.getTime() + 4 * 3600e3);
const okRes = await request.post(`${API_URL}/schedules`, {
headers: auth(),
data: { trainId: UI_IDS.train, routeId: ROUTE_ID, departureAt: dep.toISOString(), arrivalAt: arr.toISOString() },
// ROUTE_ID has no route coach template, so createSchedule needs an explicit coach or it 400s
// on the "zero coaches assigned" guard (see schedules.service.ts).
data: {
trainId: UI_IDS.train,
routeId: ROUTE_ID,
departureAt: dep.toISOString(),
arrivalAt: arr.toISOString(),
coachIds: [UI_IDS.coach],
},
});
expect(okRes.ok()).toBeTruthy();
const sched = (await okRes.json())?.data ?? {};