diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-25 13:50:49 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-25 13:50:49 +0200 |
| commit | a1589e75358558eada7ffc2efc7e3fa7160d233e (patch) | |
| tree | 7889a2364292cd8b90fe996da7907bebf200d3dc /opendc/api/v1/users/userId | |
| parent | 1f34466d41ba01a3dd36b0866696367d397daf7e (diff) | |
Reformat codebase and fix spelling errors
Diffstat (limited to 'opendc/api/v1/users/userId')
| -rw-r--r-- | opendc/api/v1/users/userId/authorizations/endpoint.py | 5 | ||||
| -rw-r--r-- | opendc/api/v1/users/userId/endpoint.py | 20 |
2 files changed, 14 insertions, 11 deletions
diff --git a/opendc/api/v1/users/userId/authorizations/endpoint.py b/opendc/api/v1/users/userId/authorizations/endpoint.py index 2320456f..46ca12ba 100644 --- a/opendc/api/v1/users/userId/authorizations/endpoint.py +++ b/opendc/api/v1/users/userId/authorizations/endpoint.py @@ -1,8 +1,9 @@ from opendc.models.authorization import Authorization from opendc.models.user import User -from opendc.util import database, exceptions +from opendc.util import exceptions from opendc.util.rest import Response + def GET(request): """Get this User's Authorizations.""" @@ -10,7 +11,7 @@ def GET(request): try: request.check_required_parameters( - path = { + path={ 'userId': 'int' } ) diff --git a/opendc/api/v1/users/userId/endpoint.py b/opendc/api/v1/users/userId/endpoint.py index e4edc107..767c5d13 100644 --- a/opendc/api/v1/users/userId/endpoint.py +++ b/opendc/api/v1/users/userId/endpoint.py @@ -1,7 +1,8 @@ from opendc.models.user import User -from opendc.util import database, exceptions +from opendc.util import exceptions from opendc.util.rest import Response + def DELETE(request): """Delete this user.""" @@ -9,7 +10,7 @@ def DELETE(request): try: request.check_required_parameters( - path = { + path={ 'userId': 'int' } ) @@ -37,10 +38,11 @@ def DELETE(request): return Response( 200, - 'Succesfully deleted {}'.format(user), + 'Successfully deleted {}'.format(user), user.to_JSON() ) + def GET(request): """Get this User.""" @@ -48,7 +50,7 @@ def GET(request): try: request.check_required_parameters( - path = { + path={ 'userId': 'int' } ) @@ -71,6 +73,7 @@ def GET(request): user.to_JSON(), ) + def PUT(request): """Update this User's given name and/ or family name.""" @@ -78,13 +81,13 @@ def PUT(request): try: request.check_required_parameters( - body = { + body={ 'user': { 'givenName': 'string', 'familyName': 'string' } }, - path = { + path={ 'userId': 'int' } ) @@ -103,9 +106,9 @@ def PUT(request): if not user.google_id_has_at_least(request.google_id, 'OWN'): return Response(403, 'Forbidden from editing {}.'.format(user)) - + # Update this User - + user.given_name = request.params_body['user']['givenName'] user.family_name = request.params_body['user']['familyName'] @@ -118,4 +121,3 @@ def PUT(request): 'Successfully updated {}.'.format(user), user.to_JSON() ) - |
