Skip to content

Commit 44c11f1

Browse files
mayank-sahaieleanorreem
authored andcommitted
added Get api endpoint for getting user profile
Added GET methodi endpoint for /v1/user/me to align with REST standards
1 parent c325e11 commit 44c11f1

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/user/user.controller.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,28 @@ export class UserController {
4141
description:
4242
'Returns user profile data with their nested partner access, partner admin, course user and session user data.',
4343
})
44-
@Post('/me')
44+
@Get('/me')
4545
@UseGuards(FirebaseAuthGuard)
4646
async getUserByFirebaseId(@Req() req: Request): Promise<GetUserDto> {
4747
return req['user'];
4848
}
4949

50+
/**
51+
* This POST endpoint deviates from REST patterns.
52+
* Please use `getUserByFirebaseId` above which is a GET endpoint.
53+
* Do not delete this until frontend usage is migrated.
54+
*/
55+
@ApiBearerAuth('access-token')
56+
@ApiOperation({
57+
description:
58+
'Returns user profile data with their nested partner access, partner admin, course user and session user data.',
59+
})
60+
@Post('/me')
61+
@UseGuards(FirebaseAuthGuard)
62+
async getUserProfileByFirebaseId(@Req() req: Request): Promise<GetUserDto> {
63+
return req['user'];
64+
}
65+
5066
// TODO - work out if this is used anywhere and delete if necessary
5167
@ApiBearerAuth()
5268
@Post('/delete')

0 commit comments

Comments
 (0)