MCPcopy Index your code
hub / github.com/diffgram/diffgram / task_review_api

Function task_review_api

default/methods/task/task/task_review.py:11–45  ·  view source on GitHub ↗

(task_id)

Source from the content-addressed store, hash-verified

9@routes.route('/api/v1/task/<int:task_id>/review', methods = ['POST'])
10@Permission_Task.by_task_id(apis_user_list = ["builder_or_trainer"])
11def task_review_api(task_id):
12 """
13
14 """
15 spec_list = [{'comment': {
16 'kind': str,
17 'required': False
18 }},
19 {'action': {
20 'kind': str,
21 'valid_values_list': ['approve', 'request_change']
22 }}
23 ]
24
25 log, input, untrusted_input = regular_input.master(request = request,
26 spec_list = spec_list)
27 if len(log["error"].keys()) >= 1:
28 return jsonify(log = log), 400
29
30 with sessionMaker.session_scope() as session:
31 member = get_member(session = session)
32
33 task_serialized = task_review_core(session = session,
34 task_id = task_id,
35 action = input['action'],
36 member = member,
37 comment_text = input['comment'])
38
39 if task_serialized is False:
40 log['info']['task'] = "No Task Found"
41 return jsonify(log = log), 200
42
43 log['success'] = True
44 return jsonify(log = log,
45 task = task_serialized), 200
46
47
48def task_review_core(session,

Callers

nothing calls this directly

Calls 2

get_memberFunction · 0.85
task_review_coreFunction · 0.85

Tested by

no test coverage detected