feat: improve gas station management workflow
This commit is contained in:
@@ -49,7 +49,14 @@ func RegisterPlatform(serviceKey string, engine *gin.Engine) {
|
||||
}
|
||||
|
||||
func registerGasRoute(group *gin.RouterGroup) {
|
||||
registerWritableResource(group, "/gas_basic", gas.ListGasBasic, gas.CreateGasBasic, gas.GetGasBasic, gas.UpdateGasBasic, &models.GasBasic{})
|
||||
basic := group.Group("/gas_basic")
|
||||
basic.GET("", gas.ListGasBasic)
|
||||
basic.POST("", gas.CreateGasBasic)
|
||||
basic.GET("/:identity", gas.GetGasBasic)
|
||||
basic.PUT("/:identity", gas.UpdateGasBasic)
|
||||
basic.PATCH("/:identity/status", gas.UpdateGasBasicStatus)
|
||||
basic.POST("/:identity/review", gas.ReviewGasBasic)
|
||||
basic.DELETE("/:identity", func(ctx *gin.Context) { common.ArchiveRecord(ctx, &models.GasBasic{}) })
|
||||
registerWritableResource(group, "/gas_account", gas.ListGasAccount, gas.CreateGasAccount, gas.GetGasAccount, gas.UpdateGasAccount, &models.GasAccount{})
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,18 @@ func TestPlatformGasRouteUsesGasBasic(t *testing.T) {
|
||||
t.Fatal("gas_basic list route is not registered")
|
||||
}
|
||||
|
||||
func TestPlatformGasRouteExposesReview(t *testing.T) {
|
||||
engine := gin.New()
|
||||
RegisterPlatform("heqi", engine)
|
||||
|
||||
for _, route := range engine.Routes() {
|
||||
if route.Method == http.MethodPost && route.Path == "/heqi/platform/v1/gas_basic/:identity/review" {
|
||||
return
|
||||
}
|
||||
}
|
||||
t.Fatal("gas_basic review route is not registered")
|
||||
}
|
||||
|
||||
func TestPlatformOrganizationAndAccountRoutesExposeResourceCRUD(t *testing.T) {
|
||||
engine := gin.New()
|
||||
RegisterPlatform("heqi", engine)
|
||||
|
||||
Reference in New Issue
Block a user