🐛 Fix api path

This commit is contained in:
LittleSheep 2024-11-02 10:35:36 +08:00
parent c185fde553
commit 0132b91394
3 changed files with 6 additions and 5 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
/uploads /uploads
/dist /dist
/keys
.DS_Store .DS_Store

View File

@ -9,11 +9,11 @@ func MapAPIs(app *fiber.App, baseURL string) {
{ {
publishers := api.Group("/publishers").Name("Publisher API") publishers := api.Group("/publishers").Name("Publisher API")
{ {
publishers.Get("/", listOwnedPublisher)
publishers.Post("/personal", createPersonalPublisher)
publishers.Post("/organization", createOrganizationPublisher)
publishers.Get("/:name/pins", listPinnedPost) publishers.Get("/:name/pins", listPinnedPost)
publishers.Get("/:name", getPublisher) publishers.Get("/:name", getPublisher)
publishers.Get("/owned", listOwnedPublisher)
publishers.Post("/:name/personal", createPersonalPublisher)
publishers.Post("/:name/organization", createOrganizationPublisher)
publishers.Put("/:publisherId", editPublisher) publishers.Put("/:publisherId", editPublisher)
publishers.Delete("/:publisherId", deletePublisher) publishers.Delete("/:publisherId", deletePublisher)
} }

View File

@ -58,7 +58,7 @@ func listOwnedPublisher(c *fiber.Ctx) error {
} }
func createPersonalPublisher(c *fiber.Ctx) error { func createPersonalPublisher(c *fiber.Ctx) error {
if err := sec.EnsureGrantedPerm(c, "CreatePublisher", true); err != nil { if err := sec.EnsureGrantedPerm(c, "CreatePublishers", true); err != nil {
return err return err
} }
user := c.Locals("user").(authm.Account) user := c.Locals("user").(authm.Account)
@ -71,7 +71,7 @@ func createPersonalPublisher(c *fiber.Ctx) error {
} }
func createOrganizationPublisher(c *fiber.Ctx) error { func createOrganizationPublisher(c *fiber.Ctx) error {
if err := sec.EnsureGrantedPerm(c, "CreatePublisher", true); err != nil { if err := sec.EnsureGrantedPerm(c, "CreatePublishers", true); err != nil {
return err return err
} }
user := c.Locals("user").(authm.Account) user := c.Locals("user").(authm.Account)