From 77dd03d85cd102fdcce8911056c69a041b967135 Mon Sep 17 00:00:00 2001 From: d-charlie-kim Date: Wed, 26 Jun 2024 17:40:10 +0900 Subject: [PATCH] fix: isfollow update using Req _id on getProfile --- src/user/profile.controller.ts | 7 +++++-- src/user/profile.service.ts | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/user/profile.controller.ts b/src/user/profile.controller.ts index 7ba32c7..69b491c 100644 --- a/src/user/profile.controller.ts +++ b/src/user/profile.controller.ts @@ -23,8 +23,11 @@ export class ProfileController { @Header('content-type', 'application/json') @UseGuards(JwtAuthGuard) @HandleErrors() - async getProfile(@Param('accountname') accountname: string): Promise { - return await this.profileService.getProfile(accountname); + async getProfile( + @Req() req, + @Param('accountname') accountname: string, + ): Promise { + return await this.profileService.getProfile(req.user._id, accountname); } @Post(':accountname/follow') diff --git a/src/user/profile.service.ts b/src/user/profile.service.ts index 9078161..9f1a14e 100644 --- a/src/user/profile.service.ts +++ b/src/user/profile.service.ts @@ -13,10 +13,10 @@ export class ProfileService { private userService: UserService, ) {} - async getProfile(accountname: string): Promise { - const user = await this.userService.getUserByAccountName(accountname); + async getProfile(_id: string, accountname: string): Promise { + const user = await this.userService.getUserByAccountNameResponse(accountname, _id); return { - profile: user.readOnlyData, + profile: user, }; }