mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-20 22:39:43 -04:00
Co-authored-by: Kenneth Kehl <@kkehl@flexion.us>
This commit is contained in:
@@ -276,14 +276,13 @@ def update_jobs_archived_flag(start_date, end_date):
|
||||
|
||||
@notify_command(name='populate-organisations-from-file')
|
||||
@click.option('-f', '--file_name', required=True,
|
||||
help="Pipe delimited file containing organisation name, sector, crown, argeement_signed, domains")
|
||||
help="Pipe delimited file containing organisation name, sector, agreement_signed, domains")
|
||||
def populate_organisations_from_file(file_name):
|
||||
# [0] organisation name:: name of the organisation insert if organisation is missing.
|
||||
# [1] sector:: Federal | State only
|
||||
# [2] crown:: TRUE | FALSE only
|
||||
# [3] argeement_signed:: TRUE | FALSE
|
||||
# [4] domains:: comma separated list of domains related to the organisation
|
||||
# [5] email branding name: name of the default email branding for the org
|
||||
# [2] agreement_signed:: TRUE | FALSE
|
||||
# [3] domains:: comma separated list of domains related to the organisation
|
||||
# [4] email branding name: name of the default email branding for the org
|
||||
|
||||
# The expectation is that the organisation, organisation_to_service
|
||||
# and user_to_organisation will be cleared before running this command.
|
||||
@@ -308,7 +307,6 @@ def populate_organisations_from_file(file_name):
|
||||
'name': columns[0],
|
||||
'active': True,
|
||||
'agreement_signed': boolean_or_none(columns[3]),
|
||||
'crown': boolean_or_none(columns[2]),
|
||||
'organisation_type': columns[1].lower(),
|
||||
'email_branding_id': email_branding.id if email_branding else None
|
||||
}
|
||||
|
||||
@@ -357,7 +357,6 @@ def _query_for_billing_data(notification_type, start_date, end_date, service):
|
||||
def _email_query():
|
||||
return db.session.query(
|
||||
NotificationAllTimeView.template_id,
|
||||
literal(service.crown).label('crown'),
|
||||
literal(service.id).label('service_id'),
|
||||
literal(notification_type).label('notification_type'),
|
||||
literal('ses').label('sent_by'),
|
||||
@@ -382,7 +381,6 @@ def _query_for_billing_data(notification_type, start_date, end_date, service):
|
||||
international = func.coalesce(NotificationAllTimeView.international, False)
|
||||
return db.session.query(
|
||||
NotificationAllTimeView.template_id,
|
||||
literal(service.crown).label('crown'),
|
||||
literal(service.id).label('service_id'),
|
||||
literal(notification_type).label('notification_type'),
|
||||
sent_by.label('sent_by'),
|
||||
@@ -430,7 +428,7 @@ def get_service_ids_that_need_billing_populated(start_date, end_date):
|
||||
|
||||
|
||||
def get_rate(
|
||||
rates, notification_type, date, crown=None
|
||||
rates, notification_type, date
|
||||
):
|
||||
start_of_day = get_local_midnight_in_utc(date)
|
||||
|
||||
@@ -450,8 +448,7 @@ def update_fact_billing(data, process_day):
|
||||
rates = get_rates_for_billing()
|
||||
rate = get_rate(rates,
|
||||
data.notification_type,
|
||||
process_day,
|
||||
data.crown)
|
||||
process_day)
|
||||
billing_record = create_billing_record(data, rate, process_day)
|
||||
|
||||
table = FactBilling.__table__
|
||||
|
||||
@@ -83,9 +83,6 @@ def dao_update_organisation(organisation_id, **kwargs):
|
||||
if 'organisation_type' in kwargs:
|
||||
_update_organisation_services(organisation, 'organisation_type', only_where_none=False)
|
||||
|
||||
if 'crown' in kwargs:
|
||||
_update_organisation_services(organisation, 'crown', only_where_none=False)
|
||||
|
||||
if 'email_branding_id' in kwargs:
|
||||
_update_organisation_services(organisation, 'email_branding')
|
||||
|
||||
@@ -111,7 +108,6 @@ def dao_add_service_to_organisation(service, organisation_id):
|
||||
|
||||
service.organisation_id = organisation_id
|
||||
service.organisation_type = organisation.organisation_type
|
||||
service.crown = organisation.crown
|
||||
|
||||
db.session.add(service)
|
||||
|
||||
|
||||
@@ -302,8 +302,6 @@ def dao_create_service(
|
||||
if organisation.email_branding:
|
||||
service.email_branding = organisation.email_branding
|
||||
|
||||
if organisation:
|
||||
service.crown = organisation.crown
|
||||
service.count_as_live = not user.platform_admin
|
||||
|
||||
db.session.add(service)
|
||||
|
||||
@@ -330,7 +330,6 @@ class OrganisationTypes(db.Model):
|
||||
__tablename__ = 'organisation_types'
|
||||
|
||||
name = db.Column(db.String(255), primary_key=True)
|
||||
is_crown = db.Column(db.Boolean, nullable=True)
|
||||
annual_free_sms_fragment_limit = db.Column(db.BigInteger, nullable=False)
|
||||
|
||||
|
||||
@@ -352,7 +351,6 @@ class Organisation(db.Model):
|
||||
agreement_signed_on_behalf_of_name = db.Column(db.String(255), nullable=True)
|
||||
agreement_signed_on_behalf_of_email_address = db.Column(db.String(255), nullable=True)
|
||||
agreement_signed_version = db.Column(db.Float, nullable=True)
|
||||
crown = db.Column(db.Boolean, nullable=True)
|
||||
organisation_type = db.Column(
|
||||
db.String(255),
|
||||
db.ForeignKey('organisation_types.name'),
|
||||
@@ -396,7 +394,6 @@ class Organisation(db.Model):
|
||||
"id": str(self.id),
|
||||
"name": self.name,
|
||||
"active": self.active,
|
||||
"crown": self.crown,
|
||||
"organisation_type": self.organisation_type,
|
||||
"email_branding_id": self.email_branding_id,
|
||||
"agreement_signed": self.agreement_signed,
|
||||
@@ -457,7 +454,6 @@ class Service(db.Model, Versioned):
|
||||
unique=False,
|
||||
nullable=True,
|
||||
)
|
||||
crown = db.Column(db.Boolean, index=False, nullable=True)
|
||||
rate_limit = db.Column(db.Integer, index=False, nullable=False, default=3000)
|
||||
contact_link = db.Column(db.String(255), nullable=True, unique=False)
|
||||
volume_sms = db.Column(db.Integer(), nullable=True, unique=False)
|
||||
|
||||
@@ -8,10 +8,9 @@ post_create_organisation_schema = {
|
||||
"properties": {
|
||||
"name": {"type": "string"},
|
||||
"active": {"type": ["boolean", "null"]},
|
||||
"crown": {"type": "boolean"},
|
||||
"organisation_type": {"enum": ORGANISATION_TYPES},
|
||||
},
|
||||
"required": ["name", "crown", "organisation_type"]
|
||||
"required": ["name", "organisation_type"]
|
||||
}
|
||||
|
||||
post_update_organisation_schema = {
|
||||
@@ -21,7 +20,6 @@ post_update_organisation_schema = {
|
||||
"properties": {
|
||||
"name": {"type": ["string", "null"]},
|
||||
"active": {"type": ["boolean", "null"]},
|
||||
"crown": {"type": ["boolean", "null"]},
|
||||
"organisation_type": {"enum": ORGANISATION_TYPES},
|
||||
},
|
||||
"required": []
|
||||
|
||||
@@ -209,9 +209,8 @@ def send_notifications_on_mou_signed(organisation_id):
|
||||
send_notification_to_queue(saved_notification, research_mode=False, queue=QueueNames.NOTIFY)
|
||||
|
||||
personalisation = {
|
||||
'mou_link': '{}/agreement/{}.pdf'.format(
|
||||
current_app.config['ADMIN_BASE_URL'],
|
||||
'crown' if organisation.crown else 'non-crown'
|
||||
'mou_link': '{}/agreement/agreement.pdf'.format(
|
||||
current_app.config['ADMIN_BASE_URL']
|
||||
),
|
||||
'org_name': organisation.name,
|
||||
'org_dashboard_link': '{}/organisations/{}'.format(
|
||||
|
||||
@@ -258,7 +258,6 @@ class ServiceSchema(BaseSchema, UUIDsAsStringsMixin):
|
||||
'complaints',
|
||||
'contact_list',
|
||||
'created_at',
|
||||
'crown',
|
||||
'data_retention',
|
||||
'guest_list',
|
||||
'inbound_number',
|
||||
@@ -312,7 +311,6 @@ class DetailedServiceSchema(BaseSchema):
|
||||
'api_keys',
|
||||
'contact_list',
|
||||
'created_by',
|
||||
'crown',
|
||||
'email_branding',
|
||||
'email_from',
|
||||
'guest_list',
|
||||
|
||||
Reference in New Issue
Block a user