refactor platform domain states and permissions

This commit is contained in:
david
2026-07-29 14:25:38 +08:00
parent d4799cd320
commit 35a52c4b06
42 changed files with 507 additions and 364 deletions

View File

@@ -115,12 +115,19 @@ func TestPlatformProductCommerceAndDeliveryRoutesFollowTheirContracts(t *testing
}
for _, resource := range []string{
"/ec_category", "/ec_product", "/ec_product_attribute", "/ec_product_image", "/ec_cart", "/ec_order", "/ec_order_item", "/ec_review",
"/ec_category", "/ec_product", "/ec_product_attribute", "/ec_product_image",
} {
assertRouteMethods(t, routes, "/heqi/platform/v1"+resource, http.MethodGet, http.MethodPost)
assertRouteMethods(t, routes, "/heqi/platform/v1"+resource+"/:identity", http.MethodGet, http.MethodPut, http.MethodDelete)
assertRouteMethods(t, routes, "/heqi/platform/v1"+resource+"/:identity/status", http.MethodPatch)
}
for _, resource := range []string{"/ec_cart", "/ec_order", "/ec_order_item", "/ec_review"} {
path := "/heqi/platform/v1" + resource
assertRouteMethods(t, routes, path, http.MethodGet)
assertRouteMethods(t, routes, path+"/:identity", http.MethodGet)
assertNoRouteMethods(t, routes, path, http.MethodPost, http.MethodPut, http.MethodPatch, http.MethodDelete)
assertNoRouteMethods(t, routes, path+"/:identity", http.MethodPost, http.MethodPut, http.MethodPatch, http.MethodDelete)
}
for _, resource := range []string{"/gasorder_item", "/gasorder_assign", "/gasorder_status", "/gasorder_track", "/gasorder_track_point", "/gasorder_confirm", "/gasorder_payment", "/gasorder_contract_revision"} {
path := "/heqi/platform/v1" + resource
@@ -177,13 +184,19 @@ func TestPlatformFinanceContentRoutesFollowTheirContracts(t *testing.T) {
}
for _, resource := range []string{
"/fin_payment", "/fin_settlement", "/fin_reconciliation",
"/cms_content", "/cs_ticket",
"/fin_settlement", "/cms_content", "/cs_ticket",
} {
assertRouteMethods(t, routes, "/heqi/platform/v1"+resource, http.MethodGet, http.MethodPost)
assertRouteMethods(t, routes, "/heqi/platform/v1"+resource+"/:identity", http.MethodGet, http.MethodPut, http.MethodDelete)
assertRouteMethods(t, routes, "/heqi/platform/v1"+resource+"/:identity/status", http.MethodPatch)
}
for _, resource := range []string{"/fin_payment", "/fin_reconciliation"} {
path := "/heqi/platform/v1" + resource
assertRouteMethods(t, routes, path, http.MethodGet)
assertRouteMethods(t, routes, path+"/:identity", http.MethodGet)
assertNoRouteMethods(t, routes, path, http.MethodPost, http.MethodPut, http.MethodPatch, http.MethodDelete)
assertNoRouteMethods(t, routes, path+"/:identity", http.MethodPost, http.MethodPut, http.MethodPatch, http.MethodDelete)
}
for _, resource := range []string{
"/wallet_basic", "/wallet_bank", "/wallet_payment", "/wallet_record", "/wallet_refund", "/wallet_apply_cash",