mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 00:38:11 +00:00
fix: ( iam ) resolve post-merge type errors and apply IAM column migrations
This commit is contained in:
@@ -131,7 +131,7 @@ export class PassengersService {
|
||||
take: 10,
|
||||
include: {
|
||||
schedule: { include: { originStation: true, destinationStation: true, train: true } },
|
||||
seats: { include: { seat: { include: { coach: { include: { seatClass: true } } } } } },
|
||||
seats: { include: { seat: { include: { coach: true } } } },
|
||||
},
|
||||
},
|
||||
loyalty: true,
|
||||
@@ -140,24 +140,24 @@ export class PassengersService {
|
||||
savedRoutes: true,
|
||||
},
|
||||
});
|
||||
if (!p) throw new NotFoundException('Passenger not found');
|
||||
if (!passenger) throw new NotFoundException('Passenger not found');
|
||||
|
||||
let iamUser: IamUserRow | null = null;
|
||||
if (p.iamUserId) {
|
||||
if (passenger.iamUserId) {
|
||||
const rows = await this.dataSource.query<IamUserRow[]>(
|
||||
`SELECT id, email, name, phone_number, metadata FROM iam.users WHERE id = $1 LIMIT 1`,
|
||||
[p.iamUserId],
|
||||
[passenger.iamUserId],
|
||||
);
|
||||
iamUser = rows[0] ?? null;
|
||||
}
|
||||
|
||||
return {
|
||||
id: p.id,
|
||||
id: passenger.id,
|
||||
fullName: iamUser?.name?.en ?? iamUser?.name?.am ?? null,
|
||||
email: iamUser?.email ?? null,
|
||||
phone: iamUser?.phone_number ?? null,
|
||||
createdAt: p.createdAt,
|
||||
bookings: p.bookings.map((b) => ({
|
||||
createdAt: passenger.createdAt,
|
||||
bookings: passenger.bookings.map((b) => ({
|
||||
id: b.id,
|
||||
bookingRef: b.bookingRef,
|
||||
status: b.status,
|
||||
@@ -181,7 +181,7 @@ export class PassengersService {
|
||||
},
|
||||
passengers: b.seats.map((bs) => ({
|
||||
fullName: bs.passengerName,
|
||||
seat: { number: bs.seat.label, coach: bs.seat.coach.label, class: bs.seat.coach.seatClass?.name ?? 'N/A' },
|
||||
seat: { number: bs.seat.seatNumber, coach: bs.seat.coach.number, class: 'N/A' },
|
||||
})),
|
||||
})),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user