Skip to content

Commit

Permalink
✨ Feat: 내 리뷰만 보도록
Browse files Browse the repository at this point in the history
  • Loading branch information
labyrinth30 committed Jun 29, 2024
1 parent 6ae1dea commit b3e36e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/reviews/reviews.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
ApiResponse,
} from '@nestjs/swagger';
import { UpdateReviewsDto } from './dto/update-reviews.dto';
import { IsReviewMine } from './guard/is-review-mine';
import { User } from '../users/decorator/user.decorator';
import { UsersModel } from '../users/entity/users.entity';
import { AccessTokenGuard } from '../auth/guard/bearer-token.guard';
Expand All @@ -35,8 +34,8 @@ export class ReviewsController {
@ApiResponse({ status: 401, description: '인증 실패' })
@Get()
@UseGuards(AccessTokenGuard)
async getReviews() {
return await this.reviewsService.getReviews();
async getReviews(@User() user: UsersModel) {
return await this.reviewsService.getReviews(user.id);
}

@ApiOperation({ summary: '테마 리뷰 상세 조회' })
Expand Down
8 changes: 6 additions & 2 deletions src/reviews/reviews.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ export class ReviewsService {
private readonly reviewsRepository: Repository<ReviewsModel>,
) {}

async getReviews() {
return await this.reviewsRepository.find();
async getReviews(id: number) {
return await this.reviewsRepository.find({
where: {
id,
},
});
}

async getReviewbyReviewId(reviewId: number) {
Expand Down

0 comments on commit b3e36e4

Please sign in to comment.