25 lines
903 B
Plaintext
25 lines
903 B
Plaintext
user_id = await get_user()
|
|
if not user_id:
|
|
return json.dumps({'status': 'error', 'message': '未登录'}, ensure_ascii=False)
|
|
|
|
|
|
data = {
|
|
'id': getID(),
|
|
'iteration_id': params_kw.get('iteration_id', ''),
|
|
'plan_name': params_kw.get('plan_name', ''),
|
|
'plan_type': params_kw.get('plan_type', ''),
|
|
'scope': params_kw.get('scope', ''),
|
|
'environment': params_kw.get('environment', ''),
|
|
'entry_criteria': params_kw.get('entry_criteria', ''),
|
|
'exit_criteria': params_kw.get('exit_criteria', ''),
|
|
'status': params_kw.get('status', ''),
|
|
'created_at': curDateString(),
|
|
}
|
|
|
|
try:
|
|
async with get_sor_context(request._run_ns, 'pipeline') as sor:
|
|
await sor.C('sd_test_plans', data)
|
|
return json.dumps({'status': 'ok', 'id': data['id']}, ensure_ascii=False)
|
|
except Exception as e:
|
|
return json.dumps({'status': 'error', 'message': str(e)}, ensure_ascii=False)
|