When SES callback is for a complaint save that to the new complaints table.

When handling the complaint we don't want to throw an exception if the message is missing fields. Only log an exception if we are unable to tie a complaint to a notification.
This commit is contained in:
Rebecca Law
2018-06-04 17:29:58 +01:00
parent 1faba916b2
commit 7fa42c2cc5
6 changed files with 214 additions and 50 deletions

12
app/dao/complaint_dao.py Normal file
View File

@@ -0,0 +1,12 @@
from app import db
from app.dao.dao_utils import transactional
from app.models import Complaint
@transactional
def save_complaint(complaint):
db.session.add(complaint)
def fetch_complaints_by_service(service_id):
return Complaint.query.filter_by(service_id=service_id).all()