🐛 Fix list replies need non-exists alias
This commit is contained in:
parent
dda0687b1a
commit
fba515fc70
@ -35,7 +35,7 @@ func MapAPIs(app *fiber.App, baseURL string) {
|
||||
posts.Post("/:postId/react", reactPost)
|
||||
posts.Delete("/:postId", deletePost)
|
||||
|
||||
posts.Get("/:post/replies", listPostReplies)
|
||||
posts.Get("/:postId/replies", listPostReplies)
|
||||
}
|
||||
|
||||
api.Get("/categories", listCategories)
|
||||
|
@ -14,7 +14,7 @@ func listPostReplies(c *fiber.Ctx) error {
|
||||
|
||||
tx := database.C
|
||||
var post models.Post
|
||||
if err := database.C.Where("alias = ?", c.Params("post")).First(&post).Error; err != nil {
|
||||
if err := database.C.Where("id = ?", c.Params("postId")).First(&post).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("unable to find post: %v", err))
|
||||
} else {
|
||||
tx = services.FilterPostReply(tx, post.ID)
|
||||
|
Loading…
Reference in New Issue
Block a user