mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
Made enums.py for all the enums to avoid cyclic imports.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
@@ -8,6 +8,7 @@ from sqlalchemy.sql.expression import case, literal
|
||||
from app import db
|
||||
from app.dao.date_util import get_calendar_year_dates, get_calendar_year_for_datetime
|
||||
from app.dao.organization_dao import dao_get_organization_live_services
|
||||
from app.enums import NotificationType
|
||||
from app.models import (
|
||||
KEY_TYPE_NORMAL,
|
||||
KEY_TYPE_TEAM,
|
||||
@@ -17,7 +18,6 @@ from app.models import (
|
||||
FactBilling,
|
||||
NotificationAllTimeView,
|
||||
NotificationHistory,
|
||||
NotificationType,
|
||||
Organization,
|
||||
Rate,
|
||||
Service,
|
||||
|
||||
@@ -7,6 +7,7 @@ from sqlalchemy.types import DateTime, Integer
|
||||
|
||||
from app import db
|
||||
from app.dao.dao_utils import autocommit
|
||||
from app.enums import NotificationType
|
||||
from app.models import (
|
||||
KEY_TYPE_NORMAL,
|
||||
KEY_TYPE_TEAM,
|
||||
@@ -23,7 +24,6 @@ from app.models import (
|
||||
NOTIFICATION_TEMPORARY_FAILURE,
|
||||
FactNotificationStatus,
|
||||
Notification,
|
||||
NotificationType,
|
||||
NotificationAllTimeView,
|
||||
Service,
|
||||
Template,
|
||||
@@ -468,7 +468,8 @@ def get_total_notifications_for_date_range(start_date, end_date):
|
||||
case(
|
||||
[
|
||||
(
|
||||
FactNotificationStatus.notification_type == NotificationType.EMAIL,
|
||||
FactNotificationStatus.notification_type
|
||||
== NotificationType.EMAIL,
|
||||
FactNotificationStatus.notification_count,
|
||||
)
|
||||
],
|
||||
@@ -479,7 +480,8 @@ def get_total_notifications_for_date_range(start_date, end_date):
|
||||
case(
|
||||
[
|
||||
(
|
||||
FactNotificationStatus.notification_type == NotificationType.SMS,
|
||||
FactNotificationStatus.notification_type
|
||||
== NotificationType.SMS,
|
||||
FactNotificationStatus.notification_count,
|
||||
)
|
||||
],
|
||||
|
||||
@@ -5,13 +5,8 @@ from sqlalchemy.orm import aliased
|
||||
|
||||
from app import db
|
||||
from app.dao.dao_utils import autocommit
|
||||
from app.models import (
|
||||
InboundSms,
|
||||
InboundSmsHistory,
|
||||
NotificationType,
|
||||
Service,
|
||||
ServiceDataRetention,
|
||||
)
|
||||
from app.enums import NotificationType
|
||||
from app.models import InboundSms, InboundSmsHistory, Service, ServiceDataRetention
|
||||
from app.utils import midnight_n_days_ago
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ from werkzeug.datastructures import MultiDict
|
||||
|
||||
from app import create_uuid, db
|
||||
from app.dao.dao_utils import autocommit
|
||||
from app.enums import NotificationType
|
||||
from app.models import (
|
||||
KEY_TYPE_TEST,
|
||||
NOTIFICATION_CREATED,
|
||||
@@ -29,7 +30,6 @@ from app.models import (
|
||||
FactNotificationStatus,
|
||||
Notification,
|
||||
NotificationHistory,
|
||||
NotificationType,
|
||||
)
|
||||
from app.utils import (
|
||||
escape_special_characters,
|
||||
|
||||
@@ -5,13 +5,8 @@ from sqlalchemy import asc, desc, func
|
||||
|
||||
from app import db
|
||||
from app.dao.dao_utils import autocommit
|
||||
from app.models import (
|
||||
FactBilling,
|
||||
NotificationType,
|
||||
ProviderDetails,
|
||||
ProviderDetailsHistory,
|
||||
User,
|
||||
)
|
||||
from app.enums import NotificationType
|
||||
from app.models import FactBilling, ProviderDetails, ProviderDetailsHistory, User
|
||||
|
||||
|
||||
def get_provider_details_by_id(provider_details_id):
|
||||
@@ -62,7 +57,8 @@ def _get_sms_providers_for_update(time_threshold):
|
||||
# get current priority of both providers
|
||||
q = (
|
||||
ProviderDetails.query.filter(
|
||||
ProviderDetails.notification_type == NotificationType.SMS, ProviderDetails.active
|
||||
ProviderDetails.notification_type == NotificationType.SMS,
|
||||
ProviderDetails.active,
|
||||
)
|
||||
.with_for_update()
|
||||
.all()
|
||||
|
||||
@@ -13,6 +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.models import (
|
||||
KEY_TYPE_TEST,
|
||||
NOTIFICATION_PERMANENT_FAILURE,
|
||||
@@ -24,7 +25,6 @@ from app.models import (
|
||||
Job,
|
||||
Notification,
|
||||
NotificationHistory,
|
||||
NotificationType,
|
||||
Organization,
|
||||
Permission,
|
||||
Service,
|
||||
@@ -106,7 +106,8 @@ def dao_fetch_live_services_data():
|
||||
case(
|
||||
[
|
||||
(
|
||||
this_year_ft_billing.c.notification_type == NotificationType.EMAIL,
|
||||
this_year_ft_billing.c.notification_type
|
||||
== NotificationType.EMAIL,
|
||||
func.sum(this_year_ft_billing.c.notifications_sent),
|
||||
)
|
||||
],
|
||||
@@ -115,7 +116,8 @@ def dao_fetch_live_services_data():
|
||||
case(
|
||||
[
|
||||
(
|
||||
this_year_ft_billing.c.notification_type == NotificationType.SMS,
|
||||
this_year_ft_billing.c.notification_type
|
||||
== NotificationType.SMS,
|
||||
func.sum(this_year_ft_billing.c.notifications_sent),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -5,13 +5,13 @@ from flask import current_app
|
||||
from sqlalchemy import String, and_, desc, func, literal, text
|
||||
|
||||
from app import db
|
||||
from app.enums import NotificationType
|
||||
from app.models import (
|
||||
JOB_STATUS_CANCELLED,
|
||||
JOB_STATUS_SCHEDULED,
|
||||
NOTIFICATION_CANCELLED,
|
||||
Job,
|
||||
Notification,
|
||||
NotificationType,
|
||||
ServiceDataRetention,
|
||||
Template,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user