Skip to content

Commit 0ab91ae

Browse files
authored
Merge pull request #85 from CS3219-AY2425S1/ms4-evan/patch-user-response
Return user id in /users/current
2 parents ef0e1ae + fcd4060 commit 0ab91ae

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Exclude, Expose } from 'class-transformer';
1+
import { Exclude } from 'class-transformer';
22

33
export class UsersResponseDto {
44
@Exclude()
@@ -9,7 +9,4 @@ export class UsersResponseDto {
99

1010
@Exclude()
1111
socialId: string;
12-
13-
@Exclude()
14-
_id: string;
1512
}

backend/gateway-service/src/modules/user/user.controller.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ export class UserController {
4343
const user = await firstValueFrom(
4444
this.userClient.send({ cmd: 'get-user-by-id' }, userId),
4545
);
46-
return plainToInstance(UsersResponseDto, user);
46+
const { _id, ...userDetails } = user;
47+
return plainToInstance(UsersResponseDto, { id: user._id, ...userDetails });
4748
}
4849

4950
@Patch('profile')

0 commit comments

Comments
 (0)