Added a query and endpoint to return the count of complaints for a date-range.

Unit tests for complaints_rest.get_complaint_count have yet to be written.
Maybe there is a better name for the new endpoint.
This commit is contained in:
Rebecca Law
2018-06-07 16:01:41 +01:00
committed by Katie Smith
parent e638653f11
commit 28beeebbf4
4 changed files with 51 additions and 11 deletions

View File

@@ -566,7 +566,8 @@ def create_ft_billing(bst_date,
def create_complaint(service=None,
notification=None):
notification=None,
created_at=None):
if not service:
service = create_service()
if not notification:
@@ -577,7 +578,8 @@ def create_complaint(service=None,
service_id=service.id,
ses_feedback_id=str(uuid.uuid4()),
complaint_type='abuse',
complaint_date=datetime.utcnow()
complaint_date=datetime.utcnow(),
created_at=created_at if created_at else datetime.now()
)
db.session.add(complaint)
db.session.commit()