feat(api): add an endpoint to check the current logged in user

This commit is contained in:
isra el
2023-05-16 10:12:23 +03:00
parent 5582b095a4
commit c8d5b5b429
2 changed files with 15 additions and 2 deletions

View File

@@ -42,6 +42,19 @@ export class AuthController {
return { data }
}
@ApiOperation({ summary: 'Get current logged in user' })
@ApiQuery({
name: 'apiKey',
required: false,
description: 'Required if jwt bearer token not provided',
})
@ApiBearerAuth()
@UseGuards(AuthGuard)
@Get('/who-am-i')
async whoAmI(@Request() req) {
return { data: req.user }
}
@UseGuards(AuthGuard)
@ApiOperation({ summary: 'Generate Api Key' })
@ApiQuery({

View File

@@ -35,7 +35,7 @@ export class RegisterDeviceInputDTO {
appVersionCode?: number
}
export class ISMSData {
export class SMSData {
@ApiProperty({
type: String,
required: true,
@@ -51,4 +51,4 @@ export class ISMSData {
})
receivers: string[]
}
export class SendSMSInputDTO extends ISMSData {}
export class SendSMSInputDTO extends SMSData {}