Add get letter contact by id endpoint

Added the GET /<uuid:service_id>/letter-contact/<uuid:letter_contact_id>
endpoint for returning a letter contact for a service with the letter contact id

Added the DAO for returning a letter contact by id
This commit is contained in:
venusbb
2017-10-04 12:26:38 +01:00
parent 1fa1ebb96f
commit 212ce302c8
4 changed files with 61 additions and 1 deletions
+10
View File
@@ -19,6 +19,16 @@ def dao_get_letter_contacts_by_service_id(service_id):
return letter_contacts
def dao_get_letter_contact_by_id(service_id, letter_contact_id):
letter_contact = db.session.query(
ServiceLetterContact
).filter(
ServiceLetterContact.service_id == service_id,
ServiceLetterContact.id == letter_contact_id
).one()
return letter_contact
def create_or_update_letter_contact(service_id, contact_block):
letter_contacts = dao_get_letter_contacts_by_service_id(service_id)
if len(letter_contacts) == 0: