summaryrefslogtreecommitdiff
path: root/opendc/api/v2/rooms/roomId/tiles/endpoint.py
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-06-24 09:13:09 +0200
committerGeorgios Andreadis <info@gandreadis.com>2020-06-24 09:13:09 +0200
commitbae760a62fc6a480fbe615dff6a7de03c7fd6d1d (patch)
tree06fc47f9922add14a3ac50fcfdfeb3d4fdc00363 /opendc/api/v2/rooms/roomId/tiles/endpoint.py
parent6fdb3e75dad15523d996e457c216647755b29101 (diff)
Add formatter
Diffstat (limited to 'opendc/api/v2/rooms/roomId/tiles/endpoint.py')
-rw-r--r--opendc/api/v2/rooms/roomId/tiles/endpoint.py40
1 files changed, 11 insertions, 29 deletions
diff --git a/opendc/api/v2/rooms/roomId/tiles/endpoint.py b/opendc/api/v2/rooms/roomId/tiles/endpoint.py
index a4ef51e7..6e498a48 100644
--- a/opendc/api/v2/rooms/roomId/tiles/endpoint.py
+++ b/opendc/api/v2/rooms/roomId/tiles/endpoint.py
@@ -10,18 +10,14 @@ def GET(request):
# Make sure required parameters are there
try:
- request.check_required_parameters(
- path={
- 'roomId': 'int'
- }
- )
+ request.check_required_parameters(path={'roomId': 'int'})
except exceptions.ParameterError as e:
return Response(400, e.message)
# Instantiate a Room from the database
- room = Room.from_primary_key((request.params_path['roomId'],))
+ room = Room.from_primary_key((request.params_path['roomId'], ))
# Make sure this Room exists
@@ -40,11 +36,7 @@ def GET(request):
for tile in tiles:
tile.read()
- return Response(
- 200,
- 'Successfully retrieved Tiles for {}.'.format(room),
- [x.to_JSON() for x in tiles]
- )
+ return Response(200, 'Successfully retrieved Tiles for {}.'.format(room), [x.to_JSON() for x in tiles])
def POST(request):
@@ -53,18 +45,12 @@ def POST(request):
# Make sure required parameters are there
try:
- request.check_required_parameters(
- path={
- 'roomId': 'int'
- },
- body={
- 'tile': {
- 'roomId': 'int',
- 'positionX': 'int',
- 'positionY': 'int'
- }
- }
- )
+ request.check_required_parameters(path={'roomId': 'int'},
+ body={'tile': {
+ 'roomId': 'int',
+ 'positionX': 'int',
+ 'positionY': 'int'
+ }})
except exceptions.ParameterError as e:
return Response(400, e.message)
@@ -74,7 +60,7 @@ def POST(request):
# Instantiate a Room from the database
- room = Room.from_primary_key((request.params_path['roomId'],))
+ room = Room.from_primary_key((request.params_path['roomId'], ))
# Make sure this Room exists
@@ -114,8 +100,4 @@ def POST(request):
tile.read()
- return Response(
- 200,
- 'Successfully added {}.'.format(tile),
- tile.to_JSON()
- )
+ return Response(200, 'Successfully added {}.'.format(tile), tile.to_JSON())