mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 07:21:13 -05:00
Getting imports right to use app.enums
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
@@ -13,7 +13,7 @@ from app.dao.organization_dao import dao_get_organization_by_email_address
|
||||
from app.dao.service_sms_sender_dao import insert_service_sms_sender
|
||||
from app.dao.service_user_dao import dao_get_service_user
|
||||
from app.dao.template_folder_dao import dao_get_valid_template_folders_by_id
|
||||
from app.enums import NotificationType
|
||||
from app.enums import NotificationType, ServicePermissionType
|
||||
from app.models import (
|
||||
KEY_TYPE_TEST,
|
||||
NOTIFICATION_PERMANENT_FAILURE,
|
||||
@@ -30,7 +30,6 @@ from app.models import (
|
||||
Service,
|
||||
ServiceEmailReplyTo,
|
||||
ServicePermission,
|
||||
ServicePermissionType,
|
||||
ServiceSmsSender,
|
||||
Template,
|
||||
TemplateHistory,
|
||||
|
||||
@@ -5,8 +5,9 @@ from app.celery import tasks
|
||||
from app.config import QueueNames
|
||||
from app.dao.inbound_sms_dao import dao_create_inbound_sms
|
||||
from app.dao.services_dao import dao_fetch_service_by_inbound_number
|
||||
from app.enums import ServicePermissionType
|
||||
from app.errors import InvalidRequest, register_errors
|
||||
from app.models import InboundSms, ServicePermissionType
|
||||
from app.models import InboundSms
|
||||
from app.notifications.sns_handlers import sns_notification_handler
|
||||
|
||||
receive_notifications_blueprint = Blueprint("receive_notifications", __name__)
|
||||
|
||||
@@ -24,6 +24,7 @@ from notifications_utils.recipients import (
|
||||
|
||||
from app import ma, models
|
||||
from app.dao.permissions_dao import permission_dao
|
||||
from app.enums import TemplateType
|
||||
from app.models import ServicePermission
|
||||
from app.utils import DATETIME_FORMAT_NO_TIMEZONE, get_template_instance
|
||||
|
||||
@@ -382,7 +383,7 @@ class TemplateSchema(BaseTemplateSchema, UUIDsAsStringsMixin):
|
||||
|
||||
@validates_schema
|
||||
def validate_type(self, data, **kwargs):
|
||||
if data.get("template_type") == models.TemplateType.EMAIL:
|
||||
if data.get("template_type") == TemplateType.EMAIL:
|
||||
subject = data.get("subject")
|
||||
if not subject or subject.strip() == "":
|
||||
raise ValidationError("Invalid template subject", "subject")
|
||||
@@ -628,7 +629,7 @@ class NotificationWithPersonalisationSchema(NotificationWithTemplateSchema):
|
||||
in_data["template"], in_data["personalisation"]
|
||||
)
|
||||
in_data["body"] = template.content_with_placeholders_filled_in
|
||||
if in_data["template"]["template_type"] != models.TemplateType.SMS:
|
||||
if in_data["template"]["template_type"] != TemplateType.SMS:
|
||||
in_data["subject"] = template.subject
|
||||
in_data["content_char_count"] = None
|
||||
else:
|
||||
|
||||
@@ -633,7 +633,7 @@ def get_detailed_services(
|
||||
|
||||
@service_blueprint.route("/<uuid:service_id>/guest-list", methods=["GET"])
|
||||
def get_guest_list(service_id):
|
||||
from app.models import GuestListRecipientType
|
||||
from app.enums import GuestListRecipientType
|
||||
|
||||
service = dao_fetch_service_by_id(service_id)
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ from app.dao.services_dao import (
|
||||
dao_fetch_service_by_id,
|
||||
)
|
||||
from app.dao.templates_dao import dao_get_template_by_id
|
||||
from app.models import KEY_TYPE_NORMAL, TemplateType
|
||||
from app.enums import TemplateType
|
||||
from app.models import KEY_TYPE_NORMAL
|
||||
from app.notifications.process_notifications import (
|
||||
persist_notification,
|
||||
send_notification_to_queue,
|
||||
|
||||
@@ -2,7 +2,8 @@ from collections import defaultdict
|
||||
from datetime import datetime
|
||||
|
||||
from app.dao.date_util import get_months_for_financial_year
|
||||
from app.models import NOTIFICATION_STATUS_TYPES, TemplateType
|
||||
from app.enums import TemplateType
|
||||
from app.models import NOTIFICATION_STATUS_TYPES
|
||||
|
||||
|
||||
def format_statistics(statistics):
|
||||
|
||||
@@ -3,13 +3,8 @@ import itertools
|
||||
from notifications_utils.recipients import allowed_to_send_to
|
||||
|
||||
from app.dao.services_dao import dao_fetch_service_by_id
|
||||
from app.models import (
|
||||
KEY_TYPE_NORMAL,
|
||||
KEY_TYPE_TEAM,
|
||||
KEY_TYPE_TEST,
|
||||
GuestListRecipientType,
|
||||
ServiceGuestList,
|
||||
)
|
||||
from app.enums import GuestListRecipientType
|
||||
from app.models import KEY_TYPE_NORMAL, KEY_TYPE_TEAM, KEY_TYPE_TEST, ServiceGuestList
|
||||
|
||||
|
||||
def get_recipients_from_request(request_json, key, type):
|
||||
|
||||
@@ -13,8 +13,9 @@ from app.dao.templates_dao import (
|
||||
dao_redact_template,
|
||||
dao_update_template,
|
||||
)
|
||||
from app.enums import TemplateType
|
||||
from app.errors import InvalidRequest, register_errors
|
||||
from app.models import Template, TemplateType
|
||||
from app.models import Template
|
||||
from app.notifications.validators import check_reply_to, service_has_permission
|
||||
from app.schema_validation import validate
|
||||
from app.schemas import (
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from app.models import TEMPLATE_PROCESS_TYPE, TemplateType
|
||||
from app.enums import TemplateType
|
||||
from app.models import TEMPLATE_PROCESS_TYPE
|
||||
from app.schema_validation.definitions import nullable_uuid, uuid
|
||||
|
||||
post_create_template_schema = {
|
||||
|
||||
@@ -41,7 +41,7 @@ def url_with_token(data, url, config, base_url=None):
|
||||
|
||||
|
||||
def get_template_instance(template, values):
|
||||
from app.models import TemplateType
|
||||
from app.enums import TemplateType
|
||||
|
||||
return {
|
||||
TemplateType.SMS: SMSMessageTemplate,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from app.models import NOTIFICATION_STATUS_TYPES, TemplateType
|
||||
from app.enums import TemplateType
|
||||
from app.models import NOTIFICATION_STATUS_TYPES
|
||||
from app.schema_validation.definitions import personalisation, uuid
|
||||
|
||||
template = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from app.models import TemplateType
|
||||
from app.enums import TemplateType
|
||||
from app.schema_validation.definitions import personalisation, uuid
|
||||
|
||||
get_template_by_id_request = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from app.models import TemplateType
|
||||
from app.enums import TemplateType
|
||||
from app.v2.template.template_schemas import get_template_by_id_response as template
|
||||
|
||||
get_all_template_request = {
|
||||
|
||||
Reference in New Issue
Block a user