Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: getProfile 시 isfollow 업데이트 안되는 문제 #25

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/user/profile.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ export class ProfileController {
@Header('content-type', 'application/json')
@UseGuards(JwtAuthGuard)
@HandleErrors()
async getProfile(@Param('accountname') accountname: string): Promise<InfoResponseDto> {
return await this.profileService.getProfile(accountname);
async getProfile(
@Req() req,
@Param('accountname') accountname: string,
): Promise<InfoResponseDto> {
return await this.profileService.getProfile(req.user._id, accountname);
}

@Post(':accountname/follow')
Expand Down
6 changes: 3 additions & 3 deletions src/user/profile.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export class ProfileService {
private userService: UserService,
) {}

async getProfile(accountname: string): Promise<InfoResponseDto> {
const user = await this.userService.getUserByAccountName(accountname);
async getProfile(_id: string, accountname: string): Promise<InfoResponseDto> {
const user = await this.userService.getUserByAccountNameResponse(accountname, _id);
return {
profile: user.readOnlyData,
profile: user,
};
}

Expand Down