src/profile/profile.controller.ts
        
                profiles
            
| Methods | 
| 
 | 
| Async follow | 
| follow(email: string, username: string) | 
| Decorators : 
                                @Post(':username/follow') | 
| Defined in src/profile/profile.controller.ts:25 | 
| 
                                Returns :      Promise<ProfileRO> | 
| Async getProfile | 
| getProfile(userId: number, username: string) | 
| Decorators : 
                                @Get(':username') | 
| Defined in src/profile/profile.controller.ts:20 | 
| 
                                Returns :      Promise<ProfileRO> | 
| Async unFollow | 
| unFollow(userId: number, username: string) | 
| Decorators : 
                                @Delete(':username/follow') | 
| Defined in src/profile/profile.controller.ts:30 | 
| 
                                Returns :      Promise<ProfileRO> | 
import { Get, Post, Delete, Param, Controller } from '@nestjs/common';
import { Request } from 'express';
import { ProfileService } from './profile.service';
import { ProfileRO } from './profile.interface';
import { User } from '../user/user.decorator';
import {
  ApiUseTags,
  ApiBearerAuth,
} from '@nestjs/swagger';
@ApiBearerAuth()
@ApiUseTags('profiles')
@Controller('profiles')
export class ProfileController {
  constructor(private readonly profileService: ProfileService) {}
  @Get(':username')
  async getProfile(@User('id') userId: number, @Param('username') username: string): Promise<ProfileRO> {
    return await this.profileService.findProfile(userId, username);
  }
  @Post(':username/follow')
  async follow(@User('email') email: string, @Param('username') username: string): Promise<ProfileRO> {
    return await this.profileService.follow(email, username);
  }
  @Delete(':username/follow')
  async unFollow(@User('id') userId: number,  @Param('username') username: string): Promise<ProfileRO> {
    return await this.profileService.unFollow(userId, username);
  }
}