- 3 CRUD JSON files: customer_balance, accounting_records, sync_state - Build script with model validation, CRUD validation, DDL generation - DDL: db/schema.sql (72 lines, 7 tables) - Scripts: validate_models.py, validate_crud.py, generate_ddl.py
34 lines
1.7 KiB
JSON
34 lines
1.7 KiB
JSON
{
|
|
"customer_balance": {
|
|
"params": {
|
|
"title": "客户余额管理",
|
|
"dbname": "sageapi",
|
|
"page_size": 20
|
|
},
|
|
"fields": [
|
|
{"name": "id", "title": "客户ID", "type": "string", "readonly": true, "width": 120},
|
|
{"name": "balance", "title": "余额", "type": "float", "width": 100, "align": "right"},
|
|
{"name": "currency", "title": "货币", "type": "string", "width": 60},
|
|
{"name": "credit_limit", "title": "信用额度", "type": "float", "width": 100, "align": "right"},
|
|
{"name": "last_recharge", "title": "最后充值", "type": "datetime", "width": 160},
|
|
{"name": "last_consumption", "title": "最后消费", "type": "datetime", "width": 160},
|
|
{"name": "status", "title": "状态", "type": "select", "width": 80, "options": [{"value": "active", "label": "正常"}, {"value": "suspended", "label": "暂停"}, {"value": "arrears", "label": "欠费"}]},
|
|
{"name": "cached_at", "title": "缓存时间", "type": "datetime", "width": 160, "readonly": true}
|
|
],
|
|
"list": {
|
|
"columns": ["id", "balance", "currency", "status", "last_recharge", "cached_at"],
|
|
"filters": [
|
|
{"field": "id", "type": "text", "label": "客户ID"},
|
|
{"field": "status", "type": "select", "label": "状态", "options": [{"value": "", "label": "全部"}, {"value": "active", "label": "正常"}, {"value": "suspended", "label": "暂停"}, {"value": "arrears", "label": "欠费"}]}
|
|
]
|
|
},
|
|
"view": {"fields": ["id", "balance", "currency", "credit_limit", "last_recharge", "last_consumption", "status", "cached_at"]},
|
|
"create": {"enabled": false},
|
|
"update": {
|
|
"enabled": true,
|
|
"fields": ["balance", "credit_limit", "status"]
|
|
},
|
|
"delete": {"enabled": false}
|
|
}
|
|
}
|