feat: require admin for put del post req
All checks were successful
Backend ci / build (pull_request) Successful in 3m40s
All checks were successful
Backend ci / build (pull_request) Successful in 3m40s
This commit is contained in:
@@ -21,8 +21,8 @@ func Register(router *gin.Engine, db *sql.DB) {
|
||||
|
||||
posts.GET("/", handler_posts.GetPosts)
|
||||
posts.GET("/:id", handler_posts.GetPost)
|
||||
posts.POST("/", auth.JWTMiddleware(), handler_posts.CreatePost)
|
||||
posts.PUT("/:id", auth.JWTMiddleware(), handler_posts.UpdatePost)
|
||||
posts.DELETE("/:id", auth.JWTMiddleware(), handler_posts.DeletePost)
|
||||
posts.POST("/", auth.JWTMiddleware(), auth.RequireAdmin(), handler_posts.CreatePost)
|
||||
posts.PUT("/:id", auth.JWTMiddleware(), auth.RequireAdmin(), handler_posts.UpdatePost)
|
||||
posts.DELETE("/:id", auth.JWTMiddleware(), auth.RequireAdmin(), handler_posts.DeletePost)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user