pricing/wwwroot/pricing_program_timing/add_pricing_program_timing.dspy
Hermes Agent 0d841f078e feat: pricing_program discount field validation [0-1]
- Added rules to discount field: required, number, min:0, max:1
- Frontend: Form validates on submit, shows error below field
- Backend: auto-generated dspy validates before DB write
2026-06-18 17:36:40 +08:00

38 lines
606 B
Plaintext

ns = params_kw.copy()
for k,v in ns.items():
if v == 'NaN' or v == 'null':
ns[k] = None
id = params_kw.id
if not id or len(id) > 32:
id = uuid()
ns['id'] = id
db = DBPools()
dbname = get_module_dbname('pricing')
async with db.sqlorContext(dbname) as sor:
r = await sor.C('pricing_program_timing', ns.copy())
return {
"widgettype":"Message",
"options":{
"cwidth":16,
"cheight":9,
"title":"Add Success",
"timeout":3,
"message":"ok"
}
}
return {
"widgettype":"Error",
"options":{
"title":"Add Error",
"cwidth":16,
"cheight":9,
"timeout":3,
"message":"failed"
}
}