mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 19:58:11 +00:00
Update tickets.service.ts
This commit is contained in:
@@ -65,8 +65,8 @@ export class TicketsService {
|
|||||||
|
|
||||||
const iamUserIds = tickets.map(t => t.booking.passenger?.iamUserId).filter(Boolean) as string[];
|
const iamUserIds = tickets.map(t => t.booking.passenger?.iamUserId).filter(Boolean) as string[];
|
||||||
const iamRows = iamUserIds.length > 0
|
const iamRows = iamUserIds.length > 0
|
||||||
? await this.dataSource.query<{ id: string; email: string; name: any }[]>(
|
? await this.dataSource.query<{ id: string; email: string; name: any; phone_number: string | null }[]>(
|
||||||
`SELECT id, email, name FROM iam.users WHERE id = ANY($1)`,
|
`SELECT id, email, name, phone_number FROM iam.users WHERE id = ANY($1)`,
|
||||||
[iamUserIds],
|
[iamUserIds],
|
||||||
)
|
)
|
||||||
: [];
|
: [];
|
||||||
@@ -76,8 +76,8 @@ export class TicketsService {
|
|||||||
items: tickets.map((t) => {
|
items: tickets.map((t) => {
|
||||||
const iam = t.booking.passenger?.iamUserId ? iamMap.get(t.booking.passenger.iamUserId) : undefined;
|
const iam = t.booking.passenger?.iamUserId ? iamMap.get(t.booking.passenger.iamUserId) : undefined;
|
||||||
const passengerInfo = iam
|
const passengerInfo = iam
|
||||||
? { fullName: iam.name?.en ?? iam.name?.am ?? null, email: iam.email }
|
? { fullName: iam.name?.en ?? iam.name?.am ?? null, email: iam.email, phone: iam.phone_number }
|
||||||
: { fullName: 'Guest', email: t.booking.contactEmail };
|
: { fullName: 'Guest', email: t.booking.contactEmail, phone: null };
|
||||||
return {
|
return {
|
||||||
id: t.id,
|
id: t.id,
|
||||||
ticketNumber: t.barcodePayload,
|
ticketNumber: t.barcodePayload,
|
||||||
@@ -85,22 +85,22 @@ export class TicketsService {
|
|||||||
booking: {
|
booking: {
|
||||||
bookingRef: t.booking.bookingRef,
|
bookingRef: t.booking.bookingRef,
|
||||||
status: t.booking.status,
|
status: t.booking.status,
|
||||||
|
bookingType: t.booking.bookingType,
|
||||||
|
returnLegStatus: (t.booking as any).returnLegStatus ?? null,
|
||||||
|
outboundBoardedAt: (t.booking as any).outboundBoardedAt ?? null,
|
||||||
|
returnBoardedAt: (t.booking as any).returnBoardedAt ?? null,
|
||||||
|
totalMinor: t.booking.totalMinor,
|
||||||
|
currency: t.booking.currency,
|
||||||
|
displayCurrency: t.booking.displayCurrency,
|
||||||
|
displayTotalMinor: t.booking.displayTotalMinor,
|
||||||
passenger: passengerInfo,
|
passenger: passengerInfo,
|
||||||
contactEmail: t.booking.contactEmail,
|
contactEmail: t.booking.contactEmail,
|
||||||
|
contactPhone: t.booking.contactPhone,
|
||||||
|
returnSchedule: (t.booking as any).returnSchedule ?? null,
|
||||||
},
|
},
|
||||||
schedule: t.booking.schedule,
|
schedule: t.booking.schedule,
|
||||||
seat: t.booking.seats[0]?.seat,
|
seat: t.booking.seats[0]?.seat,
|
||||||
status: t.booking.status,
|
status: t.status,
|
||||||
bookingType: t.booking.bookingType,
|
|
||||||
returnLegStatus: (t.booking as any).returnLegStatus ?? null,
|
|
||||||
outboundBoardedAt: (t.booking as any).outboundBoardedAt ?? null,
|
|
||||||
returnBoardedAt: (t.booking as any).returnBoardedAt ?? null,
|
|
||||||
totalMinor: t.booking.totalMinor,
|
|
||||||
displayCurrency: t.booking.displayCurrency,
|
|
||||||
displayTotalMinor: t.booking.displayTotalMinor,
|
|
||||||
contactEmail: t.booking.contactEmail,
|
|
||||||
contactPhone: t.booking.contactPhone,
|
|
||||||
returnSchedule: (t.booking as any).returnSchedule ?? null,
|
|
||||||
validatedAt: t.validatedAt,
|
validatedAt: t.validatedAt,
|
||||||
createdAt: t.issuedAt,
|
createdAt: t.issuedAt,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user