Change relative import. Add Authentication on scheduled operation views.
This commit is contained in:
parent
76205812a0
commit
6ee46c9136
@ -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 = {
|
||||
|
@ -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 = {
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user