mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 02:52:53 +00:00
feat: Move charging routes to public v1 group and add health check endpoint
- Move charging routes from protected /api group to public /v1/charging group for packet-gateway integration - Add GET /v1/health endpoint returning status ok - Remove registerChargingRoutes function (routes now inline in registerV1Routes) - Remove registerChargingRoutes call from apiProtected group
This commit is contained in:
@@ -13,6 +13,20 @@ import (
|
||||
func registerV1Routes(router *gin.Engine, d *serverDeps) {
|
||||
v1 := router.Group("/v1")
|
||||
|
||||
// Health check
|
||||
v1.GET("/health", func(c *gin.Context) {
|
||||
c.JSON(200, gin.H{"status": "ok"})
|
||||
})
|
||||
|
||||
// Charging engine integration (public for packet-gateway integration)
|
||||
charging := v1.Group("/charging")
|
||||
{
|
||||
charging.POST("/credit/:ip/check", d.chargingH.CheckCredit)
|
||||
charging.GET("/credit/:ip/balance", d.chargingH.GetBalance)
|
||||
charging.POST("/credit/:ip/add", d.chargingH.AddCredit)
|
||||
charging.POST("/credit/:ip/deduct", d.chargingH.DeductCredit)
|
||||
}
|
||||
|
||||
auth := v1.Group("/auth")
|
||||
{
|
||||
auth.POST("/login", d.authH.Login)
|
||||
@@ -51,7 +65,6 @@ func registerV1Routes(router *gin.Engine, d *serverDeps) {
|
||||
registerBillingRoutes(apiProtected, d)
|
||||
registerConfigRoutes(apiProtected, d)
|
||||
registerChaosRoutes(apiProtected, d)
|
||||
registerChargingRoutes(apiProtected, d)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,11 +173,3 @@ func registerChaosRoutes(api *gin.RouterGroup, d *serverDeps) {
|
||||
applyRBAC(w, d.casbinSvc, "/v1/chaos", "POST", "admin")
|
||||
w.POST("/experiments", d.chaosH.Run)
|
||||
}
|
||||
|
||||
func registerChargingRoutes(api *gin.RouterGroup, d *serverDeps) {
|
||||
charging := api.Group("/charging")
|
||||
charging.POST("/credit/:ip/check", d.chargingH.CheckCredit)
|
||||
charging.GET("/credit/:ip/balance", d.chargingH.GetBalance)
|
||||
charging.POST("/credit/:ip/add", d.chargingH.AddCredit)
|
||||
charging.POST("/credit/:ip/deduct", d.chargingH.DeductCredit)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user