33 lines
542 B
Plaintext
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"
|
||
|
}
|
||
|
}
|
||
|
|