Change relative import. Add Authentication on scheduled operation views.

This commit is contained in:
Alexis Lahouze 2016-01-13 11:27:28 +01:00
parent 76205812a0
commit 6ee46c9136
3 changed files with 11 additions and 3 deletions

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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.