mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-03 13:18:32 -04:00
Add flag on create_service to decide whether we should also check if service exists
This commit is contained in:
@@ -81,10 +81,12 @@ def create_service(
|
||||
prefix_sms=True,
|
||||
message_limit=1000,
|
||||
organisation_type='central',
|
||||
postage='second'
|
||||
postage='second',
|
||||
check_if_service_exists=False
|
||||
):
|
||||
service = Service.query.filter_by(name=service_name).first()
|
||||
if not service:
|
||||
if check_if_service_exists:
|
||||
service = Service.query.filter_by(name=service_name).first()
|
||||
if (not check_if_service_exists) or (check_if_service_exists and not service):
|
||||
service = Service(
|
||||
name=service_name,
|
||||
message_limit=message_limit,
|
||||
|
||||
Reference in New Issue
Block a user