Serialise service, API keys and permissions

By serialising these straight away we can:
- not go back to the database later, potentially closing the connection
  sooner
- potentially cache the serialised data, meaning we don’t touch the
  database at all
This commit is contained in:
Chris Hill-Scott
2020-06-22 11:10:10 +01:00
parent d7b2cc6403
commit 320bca70f7
11 changed files with 113 additions and 24 deletions

View File

@@ -137,7 +137,9 @@ def get_reply_to_text(notification_type, sender_id, service, template):
def send_pdf_letter_notification(service_id, post_data):
service = dao_fetch_service_by_id(service_id)
check_service_has_permission(LETTER_TYPE, service.permissions)
check_service_has_permission(LETTER_TYPE, [
p.permission for p in service.permissions
])
check_service_over_daily_message_limit(KEY_TYPE_NORMAL, service)
validate_created_by(service, post_data['created_by'])
validate_and_format_recipient(