2026-08-02 23:24:32 +08:00
|
|
|
|
package gas
|
2026-07-30 14:16:58 +08:00
|
|
|
|
|
|
|
|
|
|
type ResourceMode string
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
Writable ResourceMode = "writable"
|
|
|
|
|
|
ReadOnly ResourceMode = "readonly"
|
|
|
|
|
|
AppendOnly ResourceMode = "append_only"
|
|
|
|
|
|
Managed ResourceMode = "managed"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type ResourceContract struct {
|
|
|
|
|
|
Domain string `json:"domain"`
|
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
|
Path string `json:"path"`
|
|
|
|
|
|
PageKind string `json:"pageKind"`
|
|
|
|
|
|
Mode ResourceMode `json:"mode"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func ExpectedResources() []ResourceContract {
|
|
|
|
|
|
items := []struct {
|
|
|
|
|
|
domain string
|
|
|
|
|
|
name string
|
|
|
|
|
|
mode ResourceMode
|
|
|
|
|
|
}{
|
|
|
|
|
|
{"delivery", "delivery_basic", Writable}, {"delivery", "delivery_account", Writable},
|
|
|
|
|
|
{"staff", "staff_account", Writable}, {"staff", "staff_credential", Writable},
|
|
|
|
|
|
{"user", "user_account", Writable}, {"user", "user_address", Writable},
|
|
|
|
|
|
{"contract", "gasorder_contract", Managed}, {"contract", "gasorder_contract_product", AppendOnly},
|
|
|
|
|
|
{"contract", "gasorder_contract_revision", ReadOnly}, {"gasorder", "gasorder_basic", AppendOnly},
|
|
|
|
|
|
{"contract", "product_info", ReadOnly},
|
|
|
|
|
|
{"finance", "wallet_basic", ReadOnly}, {"finance", "wallet_bank", ReadOnly},
|
2026-08-02 23:24:32 +08:00
|
|
|
|
{"finance", "payment_order", ReadOnly}, {"finance", "wallet_record", ReadOnly},
|
|
|
|
|
|
{"finance", "payment_refund", ReadOnly}, {"finance", "wallet_apply_cash", AppendOnly},
|
2026-07-30 14:16:58 +08:00
|
|
|
|
{"finance", "fin_settlement", ReadOnly}, {"finance", "fin_reconciliation", ReadOnly},
|
|
|
|
|
|
{"ticket", "cs_ticket", Writable},
|
|
|
|
|
|
}
|
|
|
|
|
|
result := make([]ResourceContract, 0, len(items))
|
|
|
|
|
|
for _, item := range items {
|
|
|
|
|
|
result = append(result, ResourceContract{
|
|
|
|
|
|
Domain: item.domain, Name: item.name, Path: "/" + item.name, PageKind: "list", Mode: item.mode,
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
return result
|
|
|
|
|
|
}
|