From 5047b958853945d082f6d4b0f4fc8a0c0caed6ba Mon Sep 17 00:00:00 2001 From: Mohamed Yousif Date: Sun, 26 Apr 2020 13:02:52 +0200 Subject: [PATCH] adding docs and fixing a 3 years old typo --- Dockerfile | 2 +- README.md | 27 +++++++++++++++++++++++++++ helper.py | 6 +++--- templates/index.html | 13 ------------- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6a79e85..21b90e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,5 +11,5 @@ COPY --from=builder /install /usr/local COPY . /app WORKDIR /app -CMD ["gunicorn", "--bind 127.0.0.1:8082","-w 3", "app:app"] +CMD ["gunicorn", "--bind=127.0.0.1:8082","-w 3", "app:app"] EXPOSE 8082 diff --git a/README.md b/README.md index 780b4fd..4eb5532 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,30 @@ # iStole You are being watched. + + +# API Part + +Method: POST +mimetype: json +Endpoint: / + +Request fields: + +["short_description", "long_description", "lat", "long"] + +short_description: + +a brief description of the problem (mandatory) + +long description: + +A long desciption of the problem / issue. Optional + +lat: + +GPS latitude coordinates + +long: + +GPS longitude coordinates \ No newline at end of file diff --git a/helper.py b/helper.py index 61d63c4..4cfb74c 100644 --- a/helper.py +++ b/helper.py @@ -1,11 +1,11 @@ def json_handler(data: dict, q, db) -> list: - required_data = ["short_describtion", "long_describtion", "lat", "long"] + required_data = ["short_describtion", "lat", "long", "short_description"] if not check_required(required_data, data): return [400, {"error": "missing_field"}] q.lat = data["lat"] q.long = data["long"] - q.short_describtion = data["short_describtion"] - q.long_describtion = data["long_describtion"] + q.short_describtion = data["short_describtion"] or data["short_description"] + q.long_describtion = data["long_describtion"] or data["long_description"] db.session.add(q) db.session.commit() return [200, {"response": "ok"}] diff --git a/templates/index.html b/templates/index.html index a2ef366..d3e43fb 100644 --- a/templates/index.html +++ b/templates/index.html @@ -128,11 +128,6 @@

About this application

- -