llmage/wwwroot/api/get_organizations.dspy

16 lines
380 B
Plaintext

result = []
try:
async with get_sor_context(request._run_ns, 'rbac') as sor:
orgs = await sor.sqlExe(
"select id, orgname from organization order by orgname",
{}
)
if orgs:
for r in orgs:
result.append({'value': str(r.id), 'text': r.orgname or ''})
except Exception as e:
debug(f'get_organizations error: {e}')
return json.dumps(result, ensure_ascii=False)