Skip to content

Commit

Permalink
added Get api endpoint for getting user profile
Browse files Browse the repository at this point in the history
Added GET methodi endpoint for /v1/user/me to align with REST standards
  • Loading branch information
mayank-sahai authored and eleanorreem committed May 10, 2024
1 parent c325e11 commit 44c11f1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,28 @@ export class UserController {
description:
'Returns user profile data with their nested partner access, partner admin, course user and session user data.',
})
@Post('/me')
@Get('/me')
@UseGuards(FirebaseAuthGuard)
async getUserByFirebaseId(@Req() req: Request): Promise<GetUserDto> {
return req['user'];
}

/**
* This POST endpoint deviates from REST patterns.
* Please use `getUserByFirebaseId` above which is a GET endpoint.
* Do not delete this until frontend usage is migrated.
*/
@ApiBearerAuth('access-token')
@ApiOperation({
description:
'Returns user profile data with their nested partner access, partner admin, course user and session user data.',
})
@Post('/me')
@UseGuards(FirebaseAuthGuard)
async getUserProfileByFirebaseId(@Req() req: Request): Promise<GetUserDto> {
return req['user'];
}

// TODO - work out if this is used anywhere and delete if necessary
@ApiBearerAuth()
@Post('/delete')
Expand Down

0 comments on commit 44c11f1

Please sign in to comment.