Skip to content

Commit

Permalink
fix: update post view count
Browse files Browse the repository at this point in the history
  • Loading branch information
GanghyeonSeo committed Jun 7, 2024
1 parent 39c3961 commit 517dc66
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/post/post.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ export class PostRepository {
async getPost(id: number) {
this.logger.log('getPost');
return this.prismaService.post
.findUniqueOrThrow({
.update({
where: {
id,
deletedAt: null,
},
data: {
views: {
increment: 1,
},
},
include: {
author: {
select: {
Expand Down

0 comments on commit 517dc66

Please sign in to comment.