feat: webhook server part done (#76)

This commit is contained in:
JustSong
2023-05-10 11:58:55 +08:00
parent f7999d944e
commit 374400479f
8 changed files with 385 additions and 1 deletions
+15
View File
@@ -75,6 +75,16 @@ func SetApiRouter(router *gin.Engine) {
channelRoute.PUT("/", controller.UpdateChannel)
channelRoute.DELETE("/:id", controller.DeleteChannel)
}
webhookRoute := apiRouter.Group("/webhook")
webhookRoute.Use(middleware.UserAuth())
{
webhookRoute.GET("/", controller.GetAllWebhooks)
webhookRoute.GET("/search", controller.SearchWebhooks)
webhookRoute.GET("/:id", controller.GetWebhook)
webhookRoute.POST("/", controller.AddWebhook)
webhookRoute.PUT("/", controller.UpdateWebhook)
webhookRoute.DELETE("/:id", controller.DeleteWebhook)
}
}
pushRouter := router.Group("/push")
pushRouter.Use(middleware.GlobalAPIRateLimit())
@@ -82,4 +92,9 @@ func SetApiRouter(router *gin.Engine) {
pushRouter.GET("/:username", controller.GetPushMessage)
pushRouter.POST("/:username", controller.PostPushMessage)
}
webhookRouter := router.Group("/webhook")
webhookRouter.Use(middleware.GlobalAPIRateLimit())
{
webhookRouter.POST("/:link", controller.TriggerWebhook)
}
}