mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
Restructure govuk-alerts endpoint to be internal
In response to: https://github.com/alphagov/notifications-api/pull/3305#pullrequestreview-726672421 Previously this was added among the public /v2 endpoints, but it's only meant for internal use. While only the govuk-alerts app would be able to access it, the location and /v2 URL suggested otherwise. This restructures the endpoint so it resembles other internal ones.
This commit is contained in:
@@ -133,6 +133,7 @@ def register_blueprint(application):
|
||||
from app.authentication.auth import (
|
||||
requires_admin_auth,
|
||||
requires_auth,
|
||||
requires_govuk_alerts_auth,
|
||||
requires_no_auth,
|
||||
)
|
||||
from app.billing.rest import billing_blueprint
|
||||
@@ -140,6 +141,7 @@ def register_blueprint(application):
|
||||
from app.complaint.complaint_rest import complaint_blueprint
|
||||
from app.email_branding.rest import email_branding_blueprint
|
||||
from app.events.rest import events as events_blueprint
|
||||
from app.govuk_alerts.rest import govuk_alerts_blueprint
|
||||
from app.inbound_number.rest import inbound_number_blueprint
|
||||
from app.inbound_sms.rest import inbound_sms as inbound_sms_blueprint
|
||||
from app.job.rest import job_blueprint
|
||||
@@ -269,18 +271,15 @@ def register_blueprint(application):
|
||||
broadcast_message_blueprint.before_request(requires_admin_auth)
|
||||
application.register_blueprint(broadcast_message_blueprint)
|
||||
|
||||
govuk_alerts_blueprint.before_request(requires_govuk_alerts_auth)
|
||||
application.register_blueprint(govuk_alerts_blueprint)
|
||||
|
||||
|
||||
def register_v2_blueprints(application):
|
||||
from app.authentication.auth import (
|
||||
requires_auth,
|
||||
requires_govuk_alerts_auth,
|
||||
)
|
||||
from app.authentication.auth import requires_auth
|
||||
from app.v2.broadcast.post_broadcast import (
|
||||
v2_broadcast_blueprint as post_broadcast,
|
||||
)
|
||||
from app.v2.govuk_alerts.get_broadcasts import (
|
||||
v2_govuk_alerts_blueprint as get_broadcasts,
|
||||
)
|
||||
from app.v2.inbound_sms.get_inbound_sms import (
|
||||
v2_inbound_sms_blueprint as get_inbound_sms,
|
||||
)
|
||||
@@ -321,9 +320,6 @@ def register_v2_blueprints(application):
|
||||
post_broadcast.before_request(requires_auth)
|
||||
application.register_blueprint(post_broadcast)
|
||||
|
||||
get_broadcasts.before_request(requires_govuk_alerts_auth)
|
||||
application.register_blueprint(get_broadcasts)
|
||||
|
||||
|
||||
def init_app(app):
|
||||
|
||||
|
||||
0
app/govuk_alerts/__init__.py
Normal file
0
app/govuk_alerts/__init__.py
Normal file
@@ -1,11 +1,19 @@
|
||||
from flask import jsonify
|
||||
from flask import Blueprint, jsonify
|
||||
|
||||
from app.dao.broadcast_message_dao import dao_get_all_broadcast_messages
|
||||
from app.errors import register_errors
|
||||
from app.utils import get_dt_string_or_none
|
||||
from app.v2.govuk_alerts import v2_govuk_alerts_blueprint
|
||||
|
||||
govuk_alerts_blueprint = Blueprint(
|
||||
"govuk-alerts",
|
||||
__name__,
|
||||
url_prefix='/govuk-alerts',
|
||||
)
|
||||
|
||||
register_errors(govuk_alerts_blueprint)
|
||||
|
||||
|
||||
@v2_govuk_alerts_blueprint.route('')
|
||||
@govuk_alerts_blueprint.route('')
|
||||
def get_broadcasts():
|
||||
broadcasts = dao_get_all_broadcast_messages()
|
||||
broadcasts_dict = {"alerts": [{
|
||||
@@ -1,11 +0,0 @@
|
||||
from flask import Blueprint
|
||||
|
||||
from app.v2.errors import register_errors
|
||||
|
||||
v2_govuk_alerts_blueprint = Blueprint(
|
||||
"v2_govuk-alerts_blueprint",
|
||||
__name__,
|
||||
url_prefix='/v2/govuk-alerts',
|
||||
)
|
||||
|
||||
register_errors(v2_govuk_alerts_blueprint)
|
||||
Reference in New Issue
Block a user