Browse Source

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

pull/1/head
isra el 3 years ago
parent
commit
c8d5b5b429
  1. 13
      api/src/auth/auth.controller.ts
  2. 4
      api/src/gateway/gateway.dto.ts

13
api/src/auth/auth.controller.ts

@ -42,6 +42,19 @@ export class AuthController {
return { data } 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) @UseGuards(AuthGuard)
@ApiOperation({ summary: 'Generate Api Key' }) @ApiOperation({ summary: 'Generate Api Key' })
@ApiQuery({ @ApiQuery({

4
api/src/gateway/gateway.dto.ts

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