feat: improve gas station management workflow

This commit is contained in:
david
2026-07-29 17:55:59 +08:00
parent ab0915edaf
commit fa21507a68
10 changed files with 584 additions and 25 deletions

View File

@@ -46,6 +46,9 @@ func platformMenuAllowsRequest(menus []platformbase.Menu, requestPath, method st
(resource == "delivery_basic" || resource == "staff_account") {
return true
}
if method == "GET" && menu.Identity == "gas_basic" && resource == "delivery_basic" {
return true
}
if method == "GET" && relative == "wallet_basic" &&
(menu.Identity == "gas_basic" || menu.Identity == "delivery_basic" ||
menu.Identity == "staff" || menu.Identity == "user_account" ||

View File

@@ -58,6 +58,16 @@ func TestOwnerMenusCanReadEmbeddedWallets(t *testing.T) {
}
}
func TestGasManagementCanReadDeliveryPointCounts(t *testing.T) {
menus := []platformbase.Menu{{Identity: "gas_basic"}}
if !platformMenuAllowsRequest(menus, "/heqi/platform/v1/delivery_basic", "GET") {
t.Fatal("gas management could not read its delivery point counts")
}
if platformMenuAllowsRequest(menus, "/heqi/platform/v1/delivery_basic", "POST") {
t.Fatal("gas management unexpectedly received delivery point creation access")
}
}
func TestLocationScopeValuesAreExplicit(t *testing.T) {
if !validLocationScope("standard") || !validLocationScope("precise") {
t.Fatal("supported location scopes were rejected")