diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-05-15 13:09:06 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-05-18 15:46:40 +0200 |
| commit | 2281d3265423d01e60f8cc088de5a5730bb8a910 (patch) | |
| tree | 8dc81338cfd30845717f1b9025176d26c82fe930 /opendc-web/opendc-web-api/opendc/api/v2/prefabs/endpoint.py | |
| parent | 05d2318538eba71ac0555dc5ec146499d9cb0592 (diff) | |
api: Migrate to Flask Restful
This change updates the API to use Flask Restful instead of our own
in-house REST library. This change reduces the maintenance effort and
allows us to drastically simplify the API implementation needed for the
OpenDC v2 API.
Diffstat (limited to 'opendc-web/opendc-web-api/opendc/api/v2/prefabs/endpoint.py')
| -rw-r--r-- | opendc-web/opendc-web-api/opendc/api/v2/prefabs/endpoint.py | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/opendc-web/opendc-web-api/opendc/api/v2/prefabs/endpoint.py b/opendc-web/opendc-web-api/opendc/api/v2/prefabs/endpoint.py deleted file mode 100644 index 4a30f7eb..00000000 --- a/opendc-web/opendc-web-api/opendc/api/v2/prefabs/endpoint.py +++ /dev/null @@ -1,22 +0,0 @@ -from datetime import datetime - -from opendc.models.prefab import Prefab -from opendc.util.database import Database -from opendc.util.rest import Response - - -def POST(request): - """Create a new prefab, and return that new prefab.""" - - request.check_required_parameters(body={'prefab': {'name': 'string'}}) - - prefab = Prefab(request.params_body['prefab']) - prefab.set_property('datetimeCreated', Database.datetime_to_string(datetime.now())) - prefab.set_property('datetimeLastEdited', Database.datetime_to_string(datetime.now())) - - user_id = request.current_user['sub'] - prefab.set_property('authorId', user_id) - - prefab.insert() - - return Response(200, 'Successfully created prefab.', prefab.obj) |
