fix api build issues

This commit is contained in:
2025-12-25 13:40:38 +01:00
parent 722a185dd9
commit 3ceb837e15
32 changed files with 150 additions and 133 deletions

View File

@@ -1,8 +1,12 @@
import { Body, Controller, Get, Param, Post, Put, Req, Inject } from '@nestjs/common';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { Request } from 'express';
import { DriverService } from './DriverService';
import { CompleteOnboardingInputDTO } from './dtos/CompleteOnboardingInputDTO';
type AuthenticatedRequest = {
user?: { userId: string };
};
import { CompleteOnboardingOutputDTO } from './dtos/CompleteOnboardingOutputDTO';
import { DriverRegistrationStatusDTO } from './dtos/DriverRegistrationStatusDTO';
import { DriversLeaderboardDTO } from './dtos/DriversLeaderboardDTO';
@@ -10,9 +14,6 @@ import { DriverStatsDTO } from './dtos/DriverStatsDTO';
import { GetDriverOutputDTO } from './dtos/GetDriverOutputDTO';
import { GetDriverProfileOutputDTO } from './dtos/GetDriverProfileOutputDTO';
interface AuthenticatedRequest extends Request {
user?: { userId: string };
}
@ApiTags('drivers')
@Controller('drivers')
@@ -53,7 +54,10 @@ export class DriverController {
@Body() input: CompleteOnboardingInputDTO,
@Req() req: AuthenticatedRequest,
): Promise<CompleteOnboardingOutputDTO> {
const userId = req.user!.userId;
const userId = req.user?.userId;
if (!userId) {
throw new Error('Unauthorized');
}
return await this.driverService.completeOnboarding(userId, input);
}