Skip to content

Commit

Permalink
[BE] Feat : report API 가드 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
koomin1227 committed Dec 14, 2023
1 parent 1fe5496 commit 92bf1ed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions BE/src/report/report.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export class ReportService {
private postRepository: Repository<PostEntity>,
) {}
async createReport(body: CreateReportDto, userId: string) {
const isExist = await this.postRepository.exist({
where: { id: body.post_id },
});
if (body.user_id === userId) {
throw new HttpException('자신의 게시글은 신고 할 수 없습니다.', 400);
}
const isExist = await this.postRepository.exist({
where: { id: body.post_id },
});
if (!isExist) {
throw new HttpException('신고할 대상이 존재 하지 않습니다.', 404);
}
Expand Down

0 comments on commit 92bf1ed

Please sign in to comment.