🐛 Bug fixes
This commit is contained in:
parent
5b1c0784ec
commit
78d624697c
@ -147,7 +147,7 @@ func MapAPIs(app *fiber.App, baseURL string) {
|
||||
|
||||
developers := api.Group("/dev").Name("Developers API")
|
||||
{
|
||||
developers.Post("/notify", notifyUser)
|
||||
developers.Post("/notify/:user", notifyUser)
|
||||
developers.Post("/notify/all", notifyAllUser)
|
||||
|
||||
bots := developers.Group("/bots").Name("Bots")
|
||||
|
@ -25,7 +25,6 @@ func notifyUser(c *fiber.Ctx) error {
|
||||
Metadata map[string]any `json:"metadata"`
|
||||
Priority int `json:"priority"`
|
||||
IsRealtime bool `json:"is_realtime"`
|
||||
UserID uint `json:"user_id" validate:"required"`
|
||||
}
|
||||
|
||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||
@ -37,8 +36,10 @@ func notifyUser(c *fiber.Ctx) error {
|
||||
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("unable to get client: %v", err))
|
||||
}
|
||||
|
||||
userId, _ := c.ParamsInt("user")
|
||||
|
||||
var target models.Account
|
||||
if target, err = services.GetAccount(data.UserID); err != nil {
|
||||
if target, err = services.GetAccount(uint(userId)); err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user