Merge pull request #818 from Tria-plc/main

Main
This commit is contained in:
mulish77
2026-07-19 21:58:28 +03:00
committed by GitHub
3 changed files with 188 additions and 105 deletions

View File

@@ -323,9 +323,12 @@ export class ReportsService {
status: true,
originStationId: true,
destinationStationId: true,
totalMinor: true,
currency: true,
_count: { select: { seats: true } },
},
},
seat: { include: { coach: { select: { number: true } } } },
seat: { include: { coach: { select: { number: true, coachType: { select: { name: true } } } } } },
},
orderBy: [{ seat: { coach: { number: 'asc' } } }, { seat: { seatNumber: 'asc' } }],
});
@@ -347,12 +350,19 @@ export class ReportsService {
return seats.map(bs => ({
bookingRef: bs.booking.bookingRef,
passengerName: bs.passengerName,
coachSeat: bs.seat?.coach?.number && bs.seatLabelSnapshot
? `${bs.seat.coach.number}·${bs.seatLabelSnapshot}`
: (bs.seatLabelSnapshot ?? '—'),
origin: bs.booking.originStationId ? (stationName.get(bs.booking.originStationId) ?? '—') : '—',
destination: bs.booking.destinationStationId ? (stationName.get(bs.booking.destinationStationId) ?? '—') : '—',
departureAt: schedule?.departureAt ?? null,
passengerCategory: bs.passengerCategory,
idDocumentType: bs.idDocumentType,
idDocumentNumber: bs.idDocumentNumber,
passportNumber: bs.passportNumber,
passportCountry: bs.passportCountry,
seatLabel: bs.seatLabelSnapshot,
coachNumber: bs.seat?.coach?.number ?? null,
coachType: (bs.seat?.coach as any)?.coachType?.name ?? null,
origin: bs.booking.originStationId ? (stationName.get(bs.booking.originStationId) ?? null) : null,
destination: bs.booking.destinationStationId ? (stationName.get(bs.booking.destinationStationId) ?? null) : null,
amountPaidMinor: bs.booking.totalMinor,
currency: bs.booking.currency ?? 'ETB',
isGroupBooking: (bs.booking._count?.seats ?? 0) > 1,
}));
}