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-05 17:49:16 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c5a992d02d2adada6d79c2c310b50706609db8c5
c5a992d0
1 parent
a4747ff2
Add Like Post full service
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
16 deletions
src/post/post.service.ts
src/post/post.service.ts
View file @
c5a992d
...
...
@@ -114,15 +114,6 @@ export class PostService {
return
returndata
;
}
async
getPostLike
(
id
:
number
)
{
const
likes
=
await
this
.
prisma
.
postLike
.
count
({
where
:
{
postId
:
id
,
},
});
return
likes
;
}
async
getPostbyLevel
(
difficulty
:
number
)
{
let
level
:
Level
;
if
(
difficulty
==
1
)
{
...
...
@@ -197,16 +188,13 @@ export class PostService {
userId
:
user
.
id
,
},
})
)
{
return
{
message
:
'You already liked this post'
,
};
}
)
return
this
.
getPost
(
id
);
const
post
=
await
this
.
prisma
.
postLike
.
create
({
data
:
{
post
:
{
connect
:
{
id
:
id
,
id
:
num
,
},
},
user
:
{
...
...
@@ -216,7 +204,7 @@ export class PostService {
},
},
});
return
await
this
.
getPostLike
(
id
);
return
this
.
getPost
(
id
);
}
async
commentPost
(
token
:
string
,
id
:
number
,
content
:
string
)
{
...
...
Please
register
or
login
to post a comment