rbac/wwwroot/codes/add_kv.dspy
2024-03-12 18:46:05 +08:00

33 lines
542 B
Plaintext

print(f'{params_kw=}, add_kv.dspy')
ns = params_kw.copy()
ns['id'] = uuid()
if ns.get('parentid') is None:
return {
"widgettype":"Error",
"options":{
"title":"Add Error",
"message":"need parentid"
}
}
dbname = get_definition('codesdb')
db = DBPools()
async with db.sqlorContext(dbname) as sor:
r = await sor.C('appcodes_kv', ns)
return {
"widgettype":"Message",
"options":{
"title":"Add Success",
"message":"ok"
}
}
return {
"widgettype":"Error",
"options":{
"title":"Add Error",
"message":"failed"
}
}