package interfaces import ( "58team_blog/internal/application/services" "58team_blog/internal/infrastructure" "58team_blog/internal/interfaces/api/controllers" "github.com/gin-gonic/gin" ) func BindPostAdmin(service *services.PostService, userService *services.UserService, group *gin.RouterGroup) { post := controllers.CreatePostController(service, userService) g := group.Group("/post") g.Use(infrastructure.AuthRequired) g.POST("/", post.Post) g.PUT("/:id", post.Put) g.DELETE("/:id", post.Delete) } func BindPost(service *services.PostService, userService *services.UserService, group *gin.RouterGroup) { post := controllers.CreatePostController(service, userService) g := group.Group("/post") g.GET("/", post.GetAll) g.GET("/offset/:offset", post.GetAllWithOffset) g.GET("/:id", post.GetById) } func BindUser(adminName string, adminPass string, service *services.UserService, group *gin.RouterGroup) { user := controllers.CreateUserController(service, adminName, adminPass) group.POST("/login", user.Login) group.GET("/logout", user.Logout) g_all := group.Group("/members") g_all.GET("/", user.GetAll) g_all.GET("/:id", user.FindById) g_all.GET("/name/:name", user.FindByName) g := group.Group("/team/") g.Use(infrastructure.AuthRequired) g.POST("/", user.Post) g.PUT("/:id", user.Put) g.DELETE("/:id", user.Delete) } func BindImages(images_path string, service *services.ImagesService, group *gin.RouterGroup) { images := controllers.CreateImagesController(images_path, service) g := group.Group("/images/") g.POST("/", images.PostImage) g.GET("/:path", images.GetImage) g.DELETE("/:path", images.DeleteImage) }