Toggle navigation
Toggle navigation
This project
Loading...
Sign in
엄성진
/
learn-in-web-backend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sungjin
2021-12-04 19:35:00 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a4747ff2a2d0d8e9200291e71c3a4bff2127eff1
a4747ff2
1 parent
f7a51f0d
Fix id to force number in all post service.
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
src/post/post.controller.ts
src/post/post.service.ts
src/post/post.controller.ts
View file @
a4747ff
...
...
@@ -73,7 +73,7 @@ export class PostController {
@
Post
(
'/comment/:id'
)
createComment
(
@
Body
()
body
,
@
Param
(
'id'
)
id
)
{
return
this
.
postService
.
commentPost
(
body
.
token
,
id
,
body
.
co
mm
ent
);
return
this
.
postService
.
commentPost
(
body
.
token
,
id
,
body
.
co
nt
ent
);
}
@
Delete
(
'/comment/:id'
)
...
...
src/post/post.service.ts
View file @
a4747ff
...
...
@@ -188,11 +188,12 @@ export class PostService {
}
async
likePost
(
token
:
string
,
id
:
number
)
{
const
num
=
+
id
;
const
user
=
await
this
.
auth
.
getUserFromToken
(
token
);
if
(
await
this
.
prisma
.
postLike
.
count
({
where
:
{
postId
:
id
,
postId
:
num
,
userId
:
user
.
id
,
},
})
...
...
@@ -219,12 +220,13 @@ export class PostService {
}
async
commentPost
(
token
:
string
,
id
:
number
,
content
:
string
)
{
const
num
=
+
id
;
const
user
=
await
this
.
auth
.
getUserFromToken
(
token
);
const
post
=
await
this
.
prisma
.
comment
.
create
({
data
:
{
post
:
{
connect
:
{
id
:
id
,
id
:
num
,
},
},
author
:
{
...
...
Please
register
or
login
to post a comment