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 ..fields import Object
|
||||||
|
|
||||||
from ..views.users import requires_auth
|
from .users import requires_auth
|
||||||
|
|
||||||
|
|
||||||
resource_fields = {
|
resource_fields = {
|
||||||
|
@ -26,7 +26,7 @@ from ..models.operations import Operation
|
|||||||
|
|
||||||
from ..fields import Object
|
from ..fields import Object
|
||||||
|
|
||||||
from ..views.users import requires_auth
|
from .users import requires_auth
|
||||||
|
|
||||||
|
|
||||||
resource_fields = {
|
resource_fields = {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import dateutil.parser
|
import dateutil.parser
|
||||||
|
|
||||||
from flask.ext.restful import Resource, fields, reqparse, marshal_with_field
|
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 import true
|
||||||
from sqlalchemy.orm.exc import NoResultFound
|
from sqlalchemy.orm.exc import NoResultFound
|
||||||
@ -30,6 +31,8 @@ from .. import api
|
|||||||
|
|
||||||
from ..fields import Object
|
from ..fields import Object
|
||||||
|
|
||||||
|
from .users import requires_auth
|
||||||
|
|
||||||
|
|
||||||
resource_fields = {
|
resource_fields = {
|
||||||
'id': fields.Integer,
|
'id': fields.Integer,
|
||||||
@ -61,9 +64,10 @@ get_parser.add_argument('account', type=int)
|
|||||||
|
|
||||||
class ScheduledOperationListResource(Resource):
|
class ScheduledOperationListResource(Resource):
|
||||||
@marshal_with_field(fields.List(Object(resource_fields)))
|
@marshal_with_field(fields.List(Object(resource_fields)))
|
||||||
|
@requires_auth
|
||||||
def get(self):
|
def get(self):
|
||||||
"""
|
"""
|
||||||
Get all scheduled operation for the account.
|
Get all scheduled operation for an account.
|
||||||
"""
|
"""
|
||||||
data = get_parser.parse_args()
|
data = get_parser.parse_args()
|
||||||
|
|
||||||
@ -72,6 +76,7 @@ class ScheduledOperationListResource(Resource):
|
|||||||
).all(), 200
|
).all(), 200
|
||||||
|
|
||||||
@marshal_with_field(Object(resource_fields))
|
@marshal_with_field(Object(resource_fields))
|
||||||
|
@requires_auth
|
||||||
def post(self):
|
def post(self):
|
||||||
"""
|
"""
|
||||||
Add a new scheduled operation.
|
Add a new scheduled operation.
|
||||||
@ -91,6 +96,7 @@ class ScheduledOperationListResource(Resource):
|
|||||||
|
|
||||||
class ScheduledOperationResource(Resource):
|
class ScheduledOperationResource(Resource):
|
||||||
@marshal_with_field(Object(resource_fields))
|
@marshal_with_field(Object(resource_fields))
|
||||||
|
@requires_auth
|
||||||
def get(self, id):
|
def get(self, id):
|
||||||
"""
|
"""
|
||||||
Get scheduled operation.
|
Get scheduled operation.
|
||||||
@ -103,6 +109,7 @@ class ScheduledOperationResource(Resource):
|
|||||||
return None, 404
|
return None, 404
|
||||||
|
|
||||||
@marshal_with_field(Object(resource_fields))
|
@marshal_with_field(Object(resource_fields))
|
||||||
|
@requires_auth
|
||||||
def post(self, id):
|
def post(self, id):
|
||||||
"""
|
"""
|
||||||
Update a scheduled operation.
|
Update a scheduled operation.
|
||||||
@ -132,6 +139,7 @@ class ScheduledOperationResource(Resource):
|
|||||||
return scheduled_operation, 200
|
return scheduled_operation, 200
|
||||||
|
|
||||||
@marshal_with_field(Object(resource_fields))
|
@marshal_with_field(Object(resource_fields))
|
||||||
|
@requires_auth
|
||||||
def delete(self, id):
|
def delete(self, id):
|
||||||
"""
|
"""
|
||||||
Delete a scheduled operation.
|
Delete a scheduled operation.
|
||||||
|
Loading…
Reference in New Issue
Block a user