mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-26 14:42:15 +00:00
feat: Add charging routes and handler integration to API server
- Add chargingH field to serverDeps struct - Add ChargingEngineClient initialization in buildDeps - Add NewChargingHandler with chargingEngineClient dependency - Add registerChargingRoutes function with /charging group - Add POST /charging/credit/:ip/check endpoint - Add GET /charging/credit/:ip/balance endpoint - Add POST /charging/credit/:ip/add endpoint - Add POST /charging/credit/:ip/deduct endpoint - Call registerChargingRoutes in
This commit is contained in:
@@ -51,6 +51,7 @@ func registerV1Routes(router *gin.Engine, d *serverDeps) {
|
||||
registerBillingRoutes(apiProtected, d)
|
||||
registerConfigRoutes(apiProtected, d)
|
||||
registerChaosRoutes(apiProtected, d)
|
||||
registerChargingRoutes(apiProtected, d)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,3 +160,11 @@ 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