Skip to content

Commit

Permalink
[FIX] 리뷰삭제후 고민삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
leGit-y committed Oct 22, 2023
1 parent 73b9b84 commit d347a50
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/repository/reviewRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,18 @@ const findreviewById = async (worryId: number) => {
});
};

const deleteReviewById = async (worryId: number) => {
return await prisma.review.delete({
where:{
worry_id: worryId
}
});
};


export default{
createReview,
updateReview,
findreviewById
findreviewById,
deleteReviewById
}
4 changes: 4 additions & 0 deletions src/service/worryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ const deleteWorry =async (worryId: number,userId: number) => {
if (worry.user_id != userId) {
throw new ClientException("고민글 작성자만 삭제할 수 있습니다.");
}
const review = await reviewRepository.findreviewById(worryId);
if(review){
await reviewRepository.deleteReviewById(worryId);
}

await worryRepository.deleteWorry(worryId);
}
Expand Down
2 changes: 1 addition & 1 deletion swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ paths:
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/InternalServerError'
/auth/refresh/token:
/auth/token/refresh:
post:
tags:
- Auth
Expand Down

0 comments on commit d347a50

Please sign in to comment.