refactor
This commit is contained in:
@@ -23,6 +23,19 @@ export class DriverController {
|
||||
return this.driverService.getTotalDrivers();
|
||||
}
|
||||
|
||||
@Get('current')
|
||||
@ApiOperation({ summary: 'Get current authenticated driver' })
|
||||
@ApiResponse({ status: 200, description: 'Current driver data', type: DriverDTO })
|
||||
@ApiResponse({ status: 404, description: 'Driver not found' })
|
||||
async getCurrentDriver(@Req() req: Request): Promise<DriverDTO | null> {
|
||||
// Assuming userId is available from the request (e.g., via auth middleware)
|
||||
const userId = req['user']?.userId;
|
||||
if (!userId) {
|
||||
return null;
|
||||
}
|
||||
return this.driverService.getCurrentDriver(userId);
|
||||
}
|
||||
|
||||
@Post('complete-onboarding')
|
||||
@ApiOperation({ summary: 'Complete driver onboarding for a user' })
|
||||
@ApiResponse({ status: 200, description: 'Onboarding complete', type: CompleteOnboardingOutput })
|
||||
|
||||
Reference in New Issue
Block a user