Backoffice updates, boarding pass, alternative schedule search and more

This commit is contained in:
Stephanos A
2026-06-23 10:10:55 +03:00
parent b491f39d42
commit 2d51787383
37 changed files with 1267 additions and 1040 deletions

View File

@@ -44,6 +44,7 @@ export class TicketsService {
booking: {
include: {
schedule: { include: { originStation: true, destinationStation: true, train: true } },
returnSchedule: { select: { departureAt: true, arrivalAt: true, originStation: true, destinationStation: true } },
seats: { include: { seat: { include: { coach: { include: { coachType: true } } } } } },
passenger: { include: { user: true } },
},
@@ -72,6 +73,8 @@ export class TicketsService {
displayTotalMinor: t.booking.displayTotalMinor,
passenger: t.booking.passenger?.user || { fullName: 'Guest', email: t.booking.contactEmail },
contactEmail: t.booking.contactEmail,
contactPhone: t.booking.contactPhone,
returnSchedule: (t.booking as any).returnSchedule ?? null,
},
schedule: t.booking.schedule,
seat: t.booking.seats[0]?.seat,
@@ -105,7 +108,7 @@ export class TicketsService {
legs: legSummary,
});
const qrPayload = await QRCode.toDataURL(qrData);
const barcodePayload = `EDR${booking.bookingRef}${booking.id.substring(0, 8).toUpperCase()}`;
const barcodePayload = `${booking.bookingRef}${booking.id.substring(0, 8).toUpperCase()}`;
const ticket = await this.prisma.ticket.upsert({
where: { bookingId },