From fc03694404f57829a9ff6e03af6656ce0eab03f2 Mon Sep 17 00:00:00 2001 From: realespee Date: Thu, 20 Dec 2018 08:47:55 +0300 Subject: [PATCH 1/3] create endpoint to GET all redflags --- api.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api.py b/api.py index 1a63cdb..54680fc 100644 --- a/api.py +++ b/api.py @@ -10,5 +10,10 @@ def create_red_flag(): all_redflags.append(red_flag) return jsonify({"status" : 201, "data" : [{"id" : red_flag['id'], "message" : "Created red-flag record”"}]}), 201 +@app.route('/api/v1/redflags', methods=['GET']) +def get_red_flag(): + return jsonify({"status" : 200, "data" : all_redflags}) + + if __name__ == "__main__": app.run(debug=True) \ No newline at end of file From 7e2ba90f26d2ceb0b48ec27fb173e2070961ffb1 Mon Sep 17 00:00:00 2001 From: realespee Date: Thu, 20 Dec 2018 08:49:00 +0300 Subject: [PATCH 2/3] add GET specific red-flag endpoint --- api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api.py b/api.py index 54680fc..342bf6a 100644 --- a/api.py +++ b/api.py @@ -14,6 +14,10 @@ def create_red_flag(): def get_red_flag(): return jsonify({"status" : 200, "data" : all_redflags}) +@app.route('/api/v1/redflags/', methods=['GET']) +def get_specific_red_flag(id): + flag = [flags for flags in all_redflags if flags['id'] == id] + return jsonify({"data" : flag[0], "status" : 200}) if __name__ == "__main__": app.run(debug=True) \ No newline at end of file From 5672b776d22c708acabdb974ef01e3d8e88df945 Mon Sep 17 00:00:00 2001 From: realespee Date: Thu, 20 Dec 2018 08:50:57 +0300 Subject: [PATCH 3/3] update .gitignore to ignore pytest_cache --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0dc6c8f..93501f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /apivenv/ -/.vscode/ \ No newline at end of file +/.vscode/ +/.pytest_cache/ \ No newline at end of file