diff --git a/accountant/api/views/accounts.py b/accountant/api/views/accounts.py index 6d75a83..80e4862 100644 --- a/accountant/api/views/accounts.py +++ b/accountant/api/views/accounts.py @@ -29,7 +29,7 @@ from ..models.operations import Operation from ..fields import Object -from ..views.users import requires_auth +from .users import requires_auth resource_fields = { diff --git a/accountant/api/views/operations.py b/accountant/api/views/operations.py index a6759ab..846e7dd 100644 --- a/accountant/api/views/operations.py +++ b/accountant/api/views/operations.py @@ -26,7 +26,7 @@ from ..models.operations import Operation from ..fields import Object -from ..views.users import requires_auth +from .users import requires_auth resource_fields = { diff --git a/accountant/api/views/scheduled_operations.py b/accountant/api/views/scheduled_operations.py index d6bace9..2b475fd 100644 --- a/accountant/api/views/scheduled_operations.py +++ b/accountant/api/views/scheduled_operations.py @@ -17,6 +17,7 @@ import dateutil.parser from flask.ext.restful import Resource, fields, reqparse, marshal_with_field +from flask.ext.restplus import Resource, fields, marshal_with_field from sqlalchemy import true from sqlalchemy.orm.exc import NoResultFound @@ -30,6 +31,8 @@ from .. import api from ..fields import Object +from .users import requires_auth + resource_fields = { 'id': fields.Integer, @@ -61,9 +64,10 @@ get_parser.add_argument('account', type=int) class ScheduledOperationListResource(Resource): @marshal_with_field(fields.List(Object(resource_fields))) + @requires_auth def get(self): """ - Get all scheduled operation for the account. + Get all scheduled operation for an account. """ data = get_parser.parse_args() @@ -72,6 +76,7 @@ class ScheduledOperationListResource(Resource): ).all(), 200 @marshal_with_field(Object(resource_fields)) + @requires_auth def post(self): """ Add a new scheduled operation. @@ -91,6 +96,7 @@ class ScheduledOperationListResource(Resource): class ScheduledOperationResource(Resource): @marshal_with_field(Object(resource_fields)) + @requires_auth def get(self, id): """ Get scheduled operation. @@ -103,6 +109,7 @@ class ScheduledOperationResource(Resource): return None, 404 @marshal_with_field(Object(resource_fields)) + @requires_auth def post(self, id): """ Update a scheduled operation. @@ -132,6 +139,7 @@ class ScheduledOperationResource(Resource): return scheduled_operation, 200 @marshal_with_field(Object(resource_fields)) + @requires_auth def delete(self, id): """ Delete a scheduled operation.