Skip to content

Commit ee7a6d8

Browse files
committed
Update user response
1 parent ecb073f commit ee7a6d8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

backend/gateway-service/src/modules/user/dto/user-response.dto.ts

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

33
export class UsersResponseDto {
44
@Exclude()

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class UserController {
4444
this.userClient.send({ cmd: 'get-user-by-id' }, userId),
4545
);
4646
const { _id, ...userDetails } = user;
47-
return plainToInstance(UsersResponseDto, { id: user._id, ...userDetails });
47+
return plainToInstance(UsersResponseDto, { id: _id, ...userDetails });
4848
}
4949

5050
@Patch('profile')
@@ -57,7 +57,11 @@ export class UserController {
5757
const updatedUser = await firstValueFrom(
5858
this.userClient.send({ cmd: 'update-user-profile' }, payload),
5959
);
60-
return plainToInstance(UsersResponseDto, updatedUser);
60+
const { _id, ...userDetails } = updatedUser;
61+
return plainToInstance(UsersResponseDto, {
62+
id: _id,
63+
...userDetails,
64+
});
6165
}
6266

6367
@Patch(':id/assign-admin')

0 commit comments

Comments
 (0)