💥 Unified the publisher api
This commit is contained in:
@ -14,8 +14,8 @@ func MapAPIs(app *fiber.App, baseURL string) {
|
||||
publishers.Post("/organization", createOrganizationPublisher)
|
||||
publishers.Get("/:name/pins", listPinnedPost)
|
||||
publishers.Get("/:name", getPublisher)
|
||||
publishers.Put("/:publisherId", editPublisher)
|
||||
publishers.Delete("/:publisherId", deletePublisher)
|
||||
publishers.Put("/:name", editPublisher)
|
||||
publishers.Delete("/:name", deletePublisher)
|
||||
}
|
||||
|
||||
recommendations := api.Group("/recommendations").Name("Recommendations API")
|
||||
|
@ -109,8 +109,8 @@ func editPublisher(c *fiber.Ctx) error {
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
id, _ := c.ParamsInt("publisherId", 0)
|
||||
publisher, err := services.GetPublisher(uint(id), user.ID)
|
||||
name := c.Params("name")
|
||||
publisher, err := services.GetPublisherByName(name, user.ID)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
@ -150,8 +150,8 @@ func deletePublisher(c *fiber.Ctx) error {
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
id, _ := c.ParamsInt("publisherId", 0)
|
||||
publisher, err := services.GetPublisher(uint(id), user.ID)
|
||||
name := c.Params("name")
|
||||
publisher, err := services.GetPublisherByName(name, user.ID)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
Reference in New Issue
Block a user