refactor( iam ): remove prisma.user references from passenger-side services

This commit is contained in:
Abubeker Yasin
2026-06-09 10:31:49 +03:00
parent 32f2f4b917
commit 1d35453338
9 changed files with 99 additions and 107 deletions

View File

@@ -52,25 +52,17 @@ export class PassengersController {
})
@ApiResponse({ status: 401, description: 'Unauthorized - Invalid or missing token' })
async getMe(@Request() req: any) {
if (!req.user || !req.user.userId) {
if (!req.user || !req.user.id) {
throw new UnauthorizedException('User not authenticated');
}
try {
const user = await this.prisma.user.findUnique({
where: { id: req.user.userId },
include: {
passenger: true,
},
const passenger = await this.prisma.passenger.findUnique({
where: { iamUserId: req.user.id },
});
if (!user || !user.passenger) {
return null;
}
return this.service.getProfile(user.passenger.id);
if (!passenger) return null;
return this.service.getProfile(passenger.id);
} catch (error) {
// If profile lookup fails for any reason, return null to allow app to continue
return null;
}
}