Skip to content

Commit afe6c9b

Browse files
committed
fixed
1 parent 098bc94 commit afe6c9b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

routes/routers.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func SetupRoutes(app *fiber.App, db *gorm.DB) {
6363
// Book Routes (24)
6464
bookRouter := api.Group("/books")
6565
bookRouter.Get("", endpoint.GetLatestBooks)
66-
bookRouter.Post("", endpoint.CreateBook)
66+
bookRouter.Post("", endpoint.AdminMiddleware, endpoint.CreateBook)
6767
bookRouter.Get("/bookmarked", endpoint.AuthMiddleware, endpoint.GetBookmarkedBooks)
6868
bookRouter.Get("/book/:slug/bookmark", endpoint.AuthMiddleware, endpoint.BookmarkBook)
6969
bookRouter.Post("/book/:slug/report", endpoint.AuthMiddleware, endpoint.ReportBook)
@@ -80,12 +80,12 @@ func SetupRoutes(app *fiber.App, db *gorm.DB) {
8080
bookRouter.Get("/book/:slug/vote", endpoint.AuthMiddleware, endpoint.VoteBook)
8181
bookRouter.Get("/lanterns-generation/:amount", endpoint.AuthMiddleware, endpoint.ConvertCoinsToLanterns)
8282

83-
bookRouter.Put("/book/:slug", endpoint.UpdateBook)
84-
bookRouter.Delete("/book/:slug", endpoint.DeleteBook)
85-
bookRouter.Post("/book/:slug/set-contract", endpoint.SetContract)
86-
bookRouter.Put("/book/chapter/:slug", endpoint.UpdateChapter)
87-
bookRouter.Delete("/book/chapter/:slug", endpoint.DeleteChapter)
88-
bookRouter.Post("/book/:slug/add-chapter", endpoint.AddChapter)
83+
bookRouter.Put("/book/:slug", endpoint.AdminMiddleware, endpoint.UpdateBook)
84+
bookRouter.Delete("/book/:slug", endpoint.AdminMiddleware, endpoint.DeleteBook)
85+
bookRouter.Post("/book/:slug/set-contract", endpoint.AdminMiddleware, endpoint.SetContract)
86+
bookRouter.Put("/book/chapter/:slug", endpoint.AdminMiddleware, endpoint.UpdateChapter)
87+
bookRouter.Delete("/book/chapter/:slug", endpoint.AdminMiddleware, endpoint.DeleteChapter)
88+
bookRouter.Post("/book/:slug/add-chapter", endpoint.AdminMiddleware, endpoint.AddChapter)
8989

9090
bookRouter.Get("/book/chapters/chapter/:slug", endpoint.AuthMiddleware, endpoint.GetBookChapter)
9191
bookRouter.Get("/book/chapters/chapter/:slug/paragraph/:index/comments", endpoint.AuthMiddleware, endpoint.GetParagraphComments)
@@ -126,7 +126,7 @@ func SetupRoutes(app *fiber.App, db *gorm.DB) {
126126
// ADMIN ROUTES (7)
127127
adminRouter := api.Group("/admin", endpoint.AdminMiddleware)
128128
adminRouter.Get("/", endpoint.AdminDashboard)
129-
adminUsersRouter := adminRouter.Group("/users")
129+
adminUsersRouter := adminRouter.Group("/users", endpoint.AdminMiddleware)
130130
// Admin Users
131131
adminRouter.Put("/", endpoint.UpdateProfile)
132132
adminUsersRouter.Get("", endpoint.AdminGetUsers)

0 commit comments

Comments
 (0)