🐛 Fix reaction api
This commit is contained in:
parent
5af3e280b9
commit
93251c05f4
@ -2,6 +2,7 @@ package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.solsynth.dev/hydrogen/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hydrogen/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hydrogen/interactive/pkg/internal/models"
|
||||
@ -147,10 +148,8 @@ func reactPost(c *fiber.Ctx) error {
|
||||
AccountID: user.ID,
|
||||
}
|
||||
|
||||
alias := c.Params("post")
|
||||
|
||||
var res models.Post
|
||||
if err := database.C.Where("alias = ?", alias).Select("id").First(&res).Error; err != nil {
|
||||
if err := database.C.Where("id = ?", c.Params("postId")).Select("id").First(&res).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("unable to find post to react: %v", err))
|
||||
} else {
|
||||
reaction.PostID = &res.ID
|
||||
|
Loading…
Reference in New Issue
Block a user