Passenger report updates

This commit is contained in:
Stephanos A
2026-07-19 20:58:00 +03:00
parent 80915f94ec
commit 264206b57a
3 changed files with 135 additions and 94 deletions

View File

@@ -311,7 +311,17 @@ export class ReportsService {
booking: { status: { in: ['CONFIRMED', 'BOARDED'] } },
},
include: {
booking: { select: { bookingRef: true, status: true, originStationId: true, destinationStationId: true } },
booking: {
select: {
bookingRef: true,
status: true,
originStationId: true,
destinationStationId: true,
totalMinor: true,
currency: true,
_count: { select: { seats: true } },
},
},
seat: { include: { coach: { select: { number: true, coachType: { select: { name: true } } } } } },
},
orderBy: [{ seat: { coach: { number: 'asc' } } }],
@@ -339,6 +349,9 @@ export class ReportsService {
coachType: (bs.seat?.coach as any)?.coachType?.name ?? null,
origin: bs.booking.originStationId ? (stationMap.get(bs.booking.originStationId) ?? null) : null,
destination: bs.booking.destinationStationId ? (stationMap.get(bs.booking.destinationStationId) ?? null) : null,
amountPaidMinor: bs.booking.totalMinor,
currency: bs.booking.currency ?? 'ETB',
isGroupBooking: (bs.booking._count?.seats ?? 0) > 1,
}));
}