mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 13:05:44 +00:00
chore( iam ): remove dead auth DTOs and @nestjs/jwt; migrate fayda/passenger to iamUserId
This commit is contained in:
@@ -232,10 +232,12 @@ export class PassengersService {
|
||||
|
||||
// If logged in, update user profile and link passenger
|
||||
if (isLoggedIn) {
|
||||
const user = await this.prisma.user.findUnique({
|
||||
where: { id: dto.userId },
|
||||
include: { passenger: true },
|
||||
// dto.userId is the IAM user UUID — resolve via Passenger.iamUserId
|
||||
const linkedPassenger = await this.prisma.passenger.findUnique({
|
||||
where: { iamUserId: dto.userId },
|
||||
include: { user: true },
|
||||
});
|
||||
const user = linkedPassenger?.user ?? null;
|
||||
|
||||
if (!user) {
|
||||
throw new BadRequestException('User not found');
|
||||
@@ -244,7 +246,7 @@ export class PassengersService {
|
||||
// Update user record if not already verified
|
||||
if (!user.faydaVerified && verifiedData) {
|
||||
await this.prisma.user.update({
|
||||
where: { id: dto.userId },
|
||||
where: { id: user.id },
|
||||
data: {
|
||||
fullName: finalData.passengerName,
|
||||
nationality: finalData.nationality,
|
||||
@@ -257,7 +259,7 @@ export class PassengersService {
|
||||
}
|
||||
|
||||
return {
|
||||
id: user.passenger?.id || user.id,
|
||||
id: linkedPassenger?.id || user.id,
|
||||
passengerName: finalData.passengerName,
|
||||
dateOfBirth: finalData.dateOfBirth,
|
||||
nationality: finalData.nationality,
|
||||
|
||||
Reference in New Issue
Block a user