-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 좋아요 목록 안 불러와지는 문제 수정 및 Post 응답하도록 개선
- Loading branch information
Showing
8 changed files
with
77 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,29 @@ | ||
import { createRouter } from "router"; | ||
import { likes } from "services"; | ||
import { Post, toPost } from "models"; | ||
|
||
export const likePost = createRouter({ | ||
description: "게시글에 좋아요를 합니다.", | ||
method: "POST", | ||
authorized: true, | ||
async handler(ctx): Promise<boolean> { | ||
await likes.likePost({ | ||
async handler(ctx): Promise<Post> { | ||
const post = await likes.likePost({ | ||
postId: +ctx.param.postId, | ||
userId: ctx.auth.user.id, | ||
}); | ||
return true; | ||
return toPost(post); | ||
}, | ||
}); | ||
|
||
export const unlikePost = createRouter({ | ||
description: "게시글에 좋아요를 취소합니다.", | ||
method: "DELETE", | ||
authorized: true, | ||
async handler(ctx): Promise<boolean> { | ||
await likes.unlikePost({ | ||
async handler(ctx): Promise<Post> { | ||
const post = await likes.unlikePost({ | ||
postId: +ctx.param.postId, | ||
userId: ctx.auth.user.id, | ||
}); | ||
return true; | ||
return toPost(post); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters