Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2db7925cad | ||
|
02f14863b1 | ||
|
16979bfc0b | ||
|
892470bdad | ||
|
26e7d578c7 |
@ -195,7 +195,7 @@ class Account(db.Model):
|
||||
)
|
||||
|
||||
if end:
|
||||
query = query.filter(query.c.operation_date <= str(end))
|
||||
query = query.filter(base_query.c.operation_date <= str(end))
|
||||
|
||||
elif end:
|
||||
query = query.filter(Operation.operation_date <= str(end))
|
||||
|
@ -24,6 +24,8 @@ def users():
|
||||
|
||||
|
||||
@users.command()
|
||||
@click.argument('email')
|
||||
@click.argument('password')
|
||||
def add(email, password):
|
||||
""" Add a new user. """
|
||||
user = User()
|
||||
|
@ -122,7 +122,7 @@ range_parser.add_argument(
|
||||
|
||||
|
||||
# pylint: disable=no-self-use
|
||||
@ns.route('/')
|
||||
@ns.route('')
|
||||
@ns.doc(
|
||||
security='apikey',
|
||||
responses={
|
||||
@ -205,7 +205,7 @@ class AccountResource(Resource):
|
||||
data = self.api.payload
|
||||
|
||||
# Check ID consistency.
|
||||
if data.get('id', default=account_id) != account_id:
|
||||
if data.get('id', account_id) != account_id:
|
||||
ns.abort(406, 'Id must not be provided or changed on update.')
|
||||
|
||||
# Need to get the object to update it.
|
||||
|
@ -90,7 +90,7 @@ account_range_parser.add_argument(
|
||||
|
||||
|
||||
# pylint: disable=no-self-use
|
||||
@ns.route('/')
|
||||
@ns.route('')
|
||||
@ns.doc(
|
||||
security='apikey',
|
||||
responses={
|
||||
@ -143,6 +143,8 @@ class OperationListResource(Resource):
|
||||
|
||||
db.session.add(operation) # pylint: disable=no-member
|
||||
|
||||
db.session.commit()
|
||||
|
||||
return operation, 201
|
||||
|
||||
|
||||
@ -185,7 +187,7 @@ class OperationResource(Resource):
|
||||
data = self.api.payload
|
||||
|
||||
# Check ID consistency.
|
||||
if data.get('id', default=operation_id) != operation_id:
|
||||
if data.get('id', operation_id) != operation_id:
|
||||
ns.abort(406, 'Id must not be provided or changed on update.')
|
||||
|
||||
# pylint: disable=no-member
|
||||
@ -203,6 +205,8 @@ class OperationResource(Resource):
|
||||
|
||||
db.session.merge(operation) # pylint: disable=no-member
|
||||
|
||||
db.session.commit()
|
||||
|
||||
return operation, 200
|
||||
|
||||
@ns.response(204, 'Operation deleted', operation_model)
|
||||
|
@ -68,7 +68,7 @@ account_id_parser.add_argument(
|
||||
|
||||
|
||||
# pylint: disable=no-self-use
|
||||
@ns.route('/')
|
||||
@ns.route('')
|
||||
@ns.doc(
|
||||
security='apikey',
|
||||
responses={
|
||||
@ -160,7 +160,7 @@ class ScheduledOperationResource(Resource):
|
||||
so_id = scheduled_operation_id
|
||||
|
||||
# Check ID consistency.
|
||||
if data.get('id', default=so_id) != so_id:
|
||||
if data.get('id', so_id) != so_id:
|
||||
ns.abort(406, 'Id must not be provided or changed on update.')
|
||||
|
||||
scheduled_operation = ScheduledOperation.query().get(so_id)
|
||||
|
Loading…
Reference in New Issue
Block a user