feat: implement gas and delivery admin systems
This commit is contained in:
45
backend/api/internal/logic/gas/resource_contract.go
Normal file
45
backend/api/internal/logic/gas/resource_contract.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package gas
|
||||
|
||||
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},
|
||||
{"finance", "wallet_payment", ReadOnly}, {"finance", "wallet_record", ReadOnly},
|
||||
{"finance", "wallet_refund", ReadOnly}, {"finance", "wallet_apply_cash", AppendOnly},
|
||||
{"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
|
||||
}
|
||||
Reference in New Issue
Block a user