Showing
2 changed files
with
5 additions
and
3 deletions
... | @@ -73,7 +73,7 @@ export class PostController { | ... | @@ -73,7 +73,7 @@ export class PostController { |
73 | 73 | ||
74 | @Post('/comment/:id') | 74 | @Post('/comment/:id') |
75 | createComment(@Body() body, @Param('id') id) { | 75 | createComment(@Body() body, @Param('id') id) { |
76 | - return this.postService.commentPost(body.token, id, body.comment); | 76 | + return this.postService.commentPost(body.token, id, body.content); |
77 | } | 77 | } |
78 | 78 | ||
79 | @Delete('/comment/:id') | 79 | @Delete('/comment/:id') | ... | ... |
... | @@ -188,11 +188,12 @@ export class PostService { | ... | @@ -188,11 +188,12 @@ export class PostService { |
188 | } | 188 | } |
189 | 189 | ||
190 | async likePost(token: string, id: number) { | 190 | async likePost(token: string, id: number) { |
191 | + const num = +id; | ||
191 | const user = await this.auth.getUserFromToken(token); | 192 | const user = await this.auth.getUserFromToken(token); |
192 | if ( | 193 | if ( |
193 | await this.prisma.postLike.count({ | 194 | await this.prisma.postLike.count({ |
194 | where: { | 195 | where: { |
195 | - postId: id, | 196 | + postId: num, |
196 | userId: user.id, | 197 | userId: user.id, |
197 | }, | 198 | }, |
198 | }) | 199 | }) |
... | @@ -219,12 +220,13 @@ export class PostService { | ... | @@ -219,12 +220,13 @@ export class PostService { |
219 | } | 220 | } |
220 | 221 | ||
221 | async commentPost(token: string, id: number, content: string) { | 222 | async commentPost(token: string, id: number, content: string) { |
223 | + const num = +id; | ||
222 | const user = await this.auth.getUserFromToken(token); | 224 | const user = await this.auth.getUserFromToken(token); |
223 | const post = await this.prisma.comment.create({ | 225 | const post = await this.prisma.comment.create({ |
224 | data: { | 226 | data: { |
225 | post: { | 227 | post: { |
226 | connect: { | 228 | connect: { |
227 | - id: id, | 229 | + id: num, |
228 | }, | 230 | }, |
229 | }, | 231 | }, |
230 | author: { | 232 | author: { | ... | ... |
-
Please register or login to post a comment