Merge pull request #118 from Tria-plc/revert-117-dev

Revert "From dev to alpha"
This commit is contained in:
Stephanos A.
2026-06-08 16:12:53 +03:00
committed by GitHub

View File

@@ -311,31 +311,12 @@ async function seedTrips() {
});
}
// Stop times: one TripStopTime per station per schedule
const stationCodes = ['SBT', 'LEB', 'BSH', 'MOJ', 'ADM', 'MTE', 'MIS', 'BIK', 'DRE', 'ADG', 'AYS', 'DAW', 'ALS', 'HOL', 'NAG'];
const stopTimeRows = [];
for (const schedule of createdSchedules) {
const dep = new Date(schedule.departureAt);
for (let i = 0; i < stationCodes.length; i++) {
const stationId = `station-${stationCodes[i].toLowerCase()}`;
const offsetMs = i * 60 * 60 * 1000; // ~1 hour between stops
stopTimeRows.push({
scheduleId: schedule.id,
stationId,
sequence: i + 1,
plannedArrivalAt: i === 0 ? null : new Date(dep.getTime() + offsetMs),
plannedDepartureAt: i === stationCodes.length - 1 ? null : new Date(dep.getTime() + offsetMs),
});
}
}
await Promise.all([
...coachAssignments.map(ca => prisma.coachAssignment.create({ data: ca })),
...liveStatuses.map(ls => prisma.tripLiveStatus.create({ data: ls })),
prisma.tripStopTime.createMany({ data: stopTimeRows }),
]);
console.log(` ✅ Train with ${createdSchedules.length} upcoming trips and stop times created`);
console.log(` ✅ Train with ${createdSchedules.length} upcoming trips created`);
}
async function seedFareRules() {