From 0132b913946e9ee32f6f592218ef833ecbd9b92d Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 2 Nov 2024 10:35:36 +0800 Subject: [PATCH] :bug: Fix api path --- .gitignore | 1 + pkg/internal/http/api/index.go | 6 +++--- pkg/internal/http/api/publishers_api.go | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index b9bcb4e..cd42558 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /uploads /dist +/keys .DS_Store diff --git a/pkg/internal/http/api/index.go b/pkg/internal/http/api/index.go index 3cfa863..9066fb6 100644 --- a/pkg/internal/http/api/index.go +++ b/pkg/internal/http/api/index.go @@ -9,11 +9,11 @@ func MapAPIs(app *fiber.App, baseURL string) { { 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", getPublisher) - publishers.Get("/owned", listOwnedPublisher) - publishers.Post("/:name/personal", createPersonalPublisher) - publishers.Post("/:name/organization", createOrganizationPublisher) publishers.Put("/:publisherId", editPublisher) publishers.Delete("/:publisherId", deletePublisher) } diff --git a/pkg/internal/http/api/publishers_api.go b/pkg/internal/http/api/publishers_api.go index badc896..7cdfaa6 100644 --- a/pkg/internal/http/api/publishers_api.go +++ b/pkg/internal/http/api/publishers_api.go @@ -58,7 +58,7 @@ func listOwnedPublisher(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 } user := c.Locals("user").(authm.Account) @@ -71,7 +71,7 @@ func createPersonalPublisher(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 } user := c.Locals("user").(authm.Account)