Skip to content

Commit

Permalink
feat: get other profile at home
Browse files Browse the repository at this point in the history
  • Loading branch information
kyeahxx19 committed Sep 7, 2024
1 parent 51c363b commit 8e6d01f
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/domain/home/home.controller.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import { Body, Controller, Get, Put, UseGuards } from '@nestjs/common';
import { Body, Controller, Get, Param, Put, UseGuards } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { AuthGuard } from '@nestjs/passport';
import { HomeService } from './home.service';
import { JwtPayload } from 'src/interfaces/auth';
import { HomeInfoResponseDto, likeHomeAnswerDto } from './dtos';
import { User } from 'src/decorators/accessUser.decorator';
import { Docs } from 'src/decorators/swagger/home.decorator';
import { OtherProfileDocs } from 'src/decorators/swagger/blurting.decorator';
import { BlurtingProfileDto } from '../blurting/dtos';
import { BlurtingService } from '../blurting/blurting.service';

@Controller('home')
@ApiTags('home')
export class HomeController {
constructor(private readonly homeService: HomeService) {}
constructor(
private readonly homeService: HomeService,
private readonly blurtingService: BlurtingService,
) {}

@Get('/')
@UseGuards(AuthGuard('access'))
Expand Down Expand Up @@ -42,6 +48,17 @@ export class HomeController {
return await this.homeService.getRandomUsers(id);
}

@UseGuards(AuthGuard('access'))
@Get('/profile/:other')
@OtherProfileDocs()
async getBlurtingProfile(
@User() userPayload: JwtPayload,
@Param('other') other: number,
): Promise<BlurtingProfileDto> {
const { id } = userPayload;
return this.blurtingService.getProfile(id, other);
}

@Get('/version')
@UseGuards(AuthGuard('access'))
@Docs('version')
Expand Down

0 comments on commit 8e6d01f

Please sign in to comment.