Make sure domains are always lowercased

Because otherwise we might get garbage duplicate data.
This commit is contained in:
Chris Hill-Scott
2019-03-08 14:38:49 +00:00
parent 6e8ce78603
commit 73ca8b73f9
2 changed files with 31 additions and 2 deletions

View File

@@ -59,12 +59,12 @@ def dao_update_organisation(organisation_id, **kwargs):
kwargs
)
if domains:
if isinstance(domains, list):
Domain.query.filter_by(organisation_id=organisation_id).delete()
db.session.bulk_save_objects([
Domain(domain=domain, organisation_id=organisation_id)
Domain(domain=domain.lower(), organisation_id=organisation_id)
for domain in domains
])