Updated the passenger web portal and added more endpoints to the api

This commit is contained in:
Stephanos A
2026-06-02 14:51:12 +03:00
parent 5059a1fe58
commit ed30ab0cda
34 changed files with 3396 additions and 674 deletions

View File

@@ -277,7 +277,10 @@ export class SchedulesService {
const schedule = await this.prisma.trainSchedule.findUnique({ where: { id } });
if (!schedule) throw new NotFoundException('Schedule not found');
// Delete related records first
// Delete related records first (in dependency order)
await this.prisma.journeySegment.deleteMany({ where: { scheduleId: id } });
await this.prisma.seatHold.deleteMany({ where: { scheduleId: id } });
await this.prisma.booking.deleteMany({ where: { scheduleId: id } });
await this.prisma.tripStopTime.deleteMany({ where: { scheduleId: id } });
await this.prisma.coachAssignment.deleteMany({ where: { scheduleId: id } });